Re: [PATCH 3/5] NFSv4: clean up state ref counting in open recover

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2013-10-21 at 13:10 -0400, Weston Andros Adamson wrote:
+AD4- There's already a valid state (the one being recovered), so just
+AD4- reference it. Also clean up error paths to avoid ref leaks.
+AD4- 
+AD4- Signed-off-by: Weston Andros Adamson +ADw-dros+AEA-netapp.com+AD4-
+AD4- ---
+AD4-  fs/nfs/nfs4proc.c +AHw- 13 +-+-+-+-+-+-+-+------
+AD4-  1 file changed, 8 insertions(+-), 5 deletions(-)
+AD4- 
+AD4- diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
+AD4- index 8140366..8ae1589 100644
+AD4- --- a/fs/nfs/nfs4proc.c
+AD4- +-+-+- b/fs/nfs/nfs4proc.c
+AD4- +AEAAQA- -1323,14 +-1323,14 +AEAAQA- +AF8-nfs4+AF8-opendata+AF8-reclaim+AF8-to+AF8-nfs4+AF8-state(struct nfs4+AF8-opendata +ACo-data)
+AD4-  		goto err+ADs-
+AD4-  	+AH0-
+AD4-  
+AD4- -	ret +AD0- -ENOMEM+ADs-
+AD4- -	state +AD0- nfs4+AF8-get+AF8-open+AF8-state(inode, data-+AD4-owner)+ADs-
+AD4- -	if (state +AD0APQ- NULL)
+AD4- +-	/+ACo- referenced the passed state +ACo-/
+AD4- +-	ret +AD0- -EINVAL+ADs-
+AD4- +-	if (state +AD0APQ- NULL +AHwAfA- +ACE-atomic+AF8-inc+AF8-not+AF8-zero(+ACY-state-+AD4-count))
+AD4-  		goto err+ADs-

We already know that state +ACEAPQ- NULL, and that state-+AD4-count +ACEAPQ- 0 here, so
I applied a simplified version of this patch that just does an
atomic+AF8-inc(+ACY-state-+AD4-count) just before the function return.

+AD4-  
+AD4-  	ret +AD0- nfs+AF8-refresh+AF8-inode(inode, +ACY-data-+AD4-f+AF8-attr)+ADs-
+AD4-  	if (ret)
+AD4- -		goto err+ADs-
+AD4- +-		goto err+AF8-put+ADs-
+AD4-  
+AD4-  	nfs+AF8-setsecurity(inode, +ACY-data-+AD4-f+AF8-attr, data-+AD4-f+AF8-label)+ADs-
+AD4-  
+AD4- +AEAAQA- -1340,9 +-1340,12 +AEAAQA- +AF8-nfs4+AF8-opendata+AF8-reclaim+AF8-to+AF8-nfs4+AF8-state(struct nfs4+AF8-opendata +ACo-data)
+AD4-  			    data-+AD4-o+AF8-arg.fmode)+ADs-
+AD4-  
+AD4-  	return state+ADs-
+AD4- +-
+AD4- +-err+AF8-put:
+AD4- +-	nfs4+AF8-put+AF8-open+AF8-state(state)+ADs-
+AD4- +-
+AD4-  err:
+AD4-  	return ERR+AF8-PTR(ret)+ADs-
+AD4- -
+AD4-  +AH0-
+AD4-  
+AD4-  static struct nfs4+AF8-state +ACo-

-- 
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust+AEA-netapp.com
www.netapp.com
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux