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

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

 



On 03/21/2012 12:03 PM, Myklebust, Trond wrote:

> 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'.


Ah, I didn't think of that.  I'll add in the try_module_get() call and put in a put_nfs_version() function to unreference the module, too.

- Bryan

> 


--
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