Re: [PATCH v4 03/23] NFS: Add version registering framework

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

 



On Wed, 2012-03-21 at 11:20 -0400, bjschuma@xxxxxxxxxx wrote:
>  
> +static int find_nfs_version(struct nfs_subversion **nfs, unsigned int version)
> +{
> +	struct nfs_subversion *tmp;
> +	spin_lock(&nfs_version_lock);
> +
> +	list_for_each_entry_safe((*nfs), tmp, &nfs_versions, list) {
> +		if ((*nfs)->version == version) {
> +			spin_unlock(&nfs_version_lock);
> +			return 1;
> +		}
> +	};
> +

BTW: The above function needs to call try_module_get() under the
nfs_version_lock. Otherwise you will not be guaranteed that the module
still exists and is live when you try to use the pointer '*nfs'.

-- 
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust@xxxxxxxxxx
www.netapp.com

��.n��������+%������w��{.n�����{��w���jg��������ݢj����G�������j:+v���w�m������w�������h�����٥



[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