summaryrefslogtreecommitdiffstats
path: root/xlators/nfs/server/src/nfs-inodes.c
diff options
context:
space:
mode:
authorAnand Avati <avati@gluster.com>2010-12-07 05:36:54 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-12-07 08:14:37 -0800
commit147b20c4a485ddb4b31b1811be4bf90610c91f7f (patch)
tree40393b9a2c5c226e612bf1caaafa027afc5f9555 /xlators/nfs/server/src/nfs-inodes.c
parent64cdcbe39bcb8d52d0c6aa88ce5cd5f3d6062a9e (diff)
nfs: cleanup inode_ref/inode_unref to fix inode leaks and extra unrefsv3.1.2qa1
Signed-off-by: Anand V. Avati <avati@blackhole.gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 2195 (Crash in __inode_retire on NFS failover) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2195
Diffstat (limited to 'xlators/nfs/server/src/nfs-inodes.c')
-rw-r--r--xlators/nfs/server/src/nfs-inodes.c45
1 files changed, 40 insertions, 5 deletions
diff --git a/xlators/nfs/server/src/nfs-inodes.c b/xlators/nfs/server/src/nfs-inodes.c
index cd334525d2d..ddc1a9c0d57 100644
--- a/xlators/nfs/server/src/nfs-inodes.c
+++ b/xlators/nfs/server/src/nfs-inodes.c
@@ -74,11 +74,12 @@ nfs_inode_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
{
struct nfs_fop_local *nfl = frame->local;
fop_create_cbk_t progcbk = NULL;
+ inode_t *linked_inode = NULL;
if (op_ret == -1)
goto do_not_link;
- inode_link (inode, nfl->parent, nfl->path, buf);
+ linked_inode = inode_link (inode, nfl->parent, nfl->path, buf);
do_not_link:
/* NFS does not need it, upper layers should not expect the pointer to
@@ -90,6 +91,12 @@ do_not_link:
if (progcbk)
progcbk (frame, cookie, this, op_ret, op_errno, fd, inode, buf,
preparent, postparent);
+
+ if (linked_inode) {
+ inode_lookup (linked_inode);
+ inode_unref (linked_inode);
+ }
+
return 0;
}
@@ -139,11 +146,12 @@ nfs_inode_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
{
struct nfs_fop_local *nfl = frame->local;
fop_mkdir_cbk_t progcbk = NULL;
+ inode_t *linked_inode = NULL;
if (op_ret == -1)
goto do_not_link;
- inode_link (inode, nfl->parent, nfl->path, buf);
+ linked_inode = inode_link (inode, nfl->parent, nfl->path, buf);
do_not_link:
inodes_nfl_to_prog_data (nfl, progcbk, frame);
@@ -151,6 +159,11 @@ do_not_link:
progcbk (frame, cookie, this, op_ret, op_errno, inode, buf,
preparent, postparent);
+ if (linked_inode) {
+ inode_lookup (linked_inode);
+ inode_unref (linked_inode);
+ }
+
return 0;
}
@@ -296,18 +309,25 @@ nfs_inode_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
{
struct nfs_fop_local *nfl = NULL;
fop_link_cbk_t progcbk = NULL;
+ inode_t *linked_inode = NULL;
if (op_ret == -1)
goto do_not_link;
nfl = frame->local;
- inode_link (inode, nfl->newparent, nfl->path, buf);
+ linked_inode = inode_link (inode, nfl->newparent, nfl->path, buf);
do_not_link:
inodes_nfl_to_prog_data (nfl, progcbk, frame);
if (progcbk)
progcbk (frame, cookie, this, op_ret, op_errno, inode, buf,
preparent, postparent);
+
+ if (linked_inode) {
+ inode_lookup (linked_inode);
+ inode_unref (linked_inode);
+ }
+
return 0;
}
@@ -349,6 +369,7 @@ nfs_inode_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
goto do_not_unlink;
inode_unlink (nfl->inode, nfl->parent, nfl->path);
+ inode_forget (nfl->inode, 0);
do_not_unlink:
inodes_nfl_to_prog_data (nfl, progcbk, frame);
@@ -396,6 +417,7 @@ nfs_inode_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
goto do_not_unlink;
inode_unlink (nfl->inode, nfl->parent, nfl->path);
+ inode_forget (nfl->inode, 0);
do_not_unlink:
inodes_nfl_to_prog_data (nfl, progcbk, frame);
@@ -438,19 +460,26 @@ nfs_inode_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
{
struct nfs_fop_local *nfl = NULL;
fop_mknod_cbk_t progcbk = NULL;
+ inode_t *linked_inode = NULL;
nfl = frame->local;
if (op_ret == -1)
goto do_not_link;
- inode_link (inode, nfl->parent, nfl->path, buf);
+ linked_inode = inode_link (inode, nfl->parent, nfl->path, buf);
do_not_link:
inodes_nfl_to_prog_data (nfl, progcbk, frame);
if (progcbk)
progcbk (frame, cookie, this, op_ret, op_errno, inode, buf,
preparent, postparent);
+
+ if (linked_inode) {
+ inode_lookup (linked_inode);
+ inode_unref (linked_inode);
+ }
+
return 0;
}
@@ -488,12 +517,13 @@ nfs_inode_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
{
struct nfs_fop_local *nfl = NULL;
fop_symlink_cbk_t progcbk = NULL;
+ inode_t *linked_inode = NULL;
nfl = frame->local;
if (op_ret == -1)
goto do_not_link;
- inode_link (inode, nfl->parent, nfl->path, buf);
+ linked_inode = inode_link (inode, nfl->parent, nfl->path, buf);
do_not_link:
inodes_nfl_to_prog_data (nfl, progcbk, frame);
@@ -501,6 +531,11 @@ do_not_link:
progcbk (frame, cookie, this, op_ret, op_errno, inode, buf,
preparent, postparent);
+ if (linked_inode) {
+ inode_lookup (linked_inode);
+ inode_unref (linked_inode);
+ }
+
return 0;
}