[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <87369avf0p.fsf@notabene.neil.brown.name>
Date: Sat, 11 Apr 2020 14:10:30 +1000
From: NeilBrown <neilb@...e.de>
To: Zhouyi Zhou <zhouzhouyi@...il.com>,
trond.myklebust@...merspace.com, anna.schumaker@...app.com,
linux-nfs@...r.kernel.org, linux-kernel@...r.kernel.org,
paulmck@...ux.ibm.com, paulmck@...ux.vnet.ibm.com, neilb@...e.com
Cc: Zhouyi Zhou <zhouzhouyi@...il.com>, 340442286 <340442286@...com>
Subject: Re: ping: [PATCH v3] NFS:remove redundant call to nfs_do_access
On Sat, Apr 11 2020, Zhouyi Zhou wrote:
> ping
You patch has landed in Linux.
Commit eb095c14030f ("NFS:remove redundant call to nfs_do_access")
Thanks,
NeilBrown
>
> On 3/6/20, Zhouyi Zhou <zhouzhouyi@...il.com> wrote:
>> In function nfs_permission:
>> 1. the rcu_read_lock and rcu_read_unlock around nfs_do_access
>> is unnecessary because the rcu critical data structure is already
>> protected in subsidiary function nfs_access_get_cached_rcu. No other
>> data structure needs rcu_read_lock in nfs_do_access.
>>
>> 2. call nfs_do_access once is enough, because:
>> 2-1. when mask has MAY_NOT_BLOCK bit
>> The second call to nfs_do_access will not happen.
>>
>> 2-2. when mask has no MAY_NOT_BLOCK bit
>> The second call to nfs_do_access will happen if res == -ECHILD, which
>> means the first nfs_do_access goes out after statement if (!may_block).
>> The second call to nfs_do_access will go through this procedure once
>> again except continue the work after if (!may_block).
>> But above work can be performed by only one call to nfs_do_access
>> without mangling the mask flag.
>>
>> Tested in x86_64
>> Signed-off-by: Zhouyi Zhou <zhouzhouyi@...il.com>
>> ---
>> fs/nfs/dir.c | 9 +--------
>> 1 files changed, 1 insertions(+), 8 deletions(-)
>>
>> diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
>> index 193d6fb..37b0c10 100644
>> --- a/fs/nfs/dir.c
>> +++ b/fs/nfs/dir.c
>> @@ -2732,14 +2732,7 @@ int nfs_permission(struct inode *inode, int mask)
>> if (!NFS_PROTO(inode)->access)
>> goto out_notsup;
>>
>> - /* Always try fast lookups first */
>> - rcu_read_lock();
>> - res = nfs_do_access(inode, cred, mask|MAY_NOT_BLOCK);
>> - rcu_read_unlock();
>> - if (res == -ECHILD && !(mask & MAY_NOT_BLOCK)) {
>> - /* Fast lookup failed, try the slow way */
>> - res = nfs_do_access(inode, cred, mask);
>> - }
>> + res = nfs_do_access(inode, cred, mask);
>> out:
>> if (!res && (mask & MAY_EXEC))
>> res = nfs_execute_ok(inode, mask);
>> --
>> 1.7.1
>>
>>
Download attachment "signature.asc" of type "application/pgp-signature" (833 bytes)
Powered by blists - more mailing lists