From: Benny Halevy <bhalevy@panasas.com>
To: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH 13/15] NFSv41: Clean up exclusive create
Date: Tue, 15 Jun 2010 12:30:00 -0400 [thread overview]
Message-ID: <4C17AA88.9080702@panasas.com> (raw)
In-Reply-To: <1276618750.8767.7.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
On Jun. 15, 2010, 12:19 -0400, Trond Myklebust <Trond.Myklebust@netapp.com> wrote:
> On Tue, 2010-06-15 at 12:08 -0400, Benny Halevy wrote:
>> On Jun. 15, 2010, 11:50 -0400, Trond Myklebust <Trond.Myklebust@netapp.com> wrote:
>>> On Mon, 2010-06-14 at 19:13 -0400, Benny Halevy wrote:
>>>> On Jun. 14, 2010, 17:51 -0400, Trond Myklebust <Trond.Myklebust@netapp.com> wrote:
>>>>> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
>>>>> ---
>>>>> fs/nfs/nfs4proc.c | 17 ++++++-----------
>>>>> include/linux/nfs_xdr.h | 6 ++++--
>>>>> 2 files changed, 10 insertions(+), 13 deletions(-)
>>>>>
>>>>> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
>>>>> index ef613ea..e9913de 100644
>>>>> --- a/fs/nfs/nfs4proc.c
>>>>> +++ b/fs/nfs/nfs4proc.c
>>>>> @@ -744,19 +744,14 @@ static struct nfs4_opendata *nfs4_opendata_alloc(struct path *path,
>>>>> p->o_arg.server = server;
>>>>> p->o_arg.bitmask = server->attr_bitmask;
>>>>> p->o_arg.claim = NFS4_OPEN_CLAIM_NULL;
>>>>> - if (flags & O_EXCL) {
>>>>> - if (nfs4_has_persistent_session(server->nfs_client)) {
>>>>> - /* GUARDED */
>>>>> - p->o_arg.u.attrs = &p->attrs;
>>>>> - memcpy(&p->attrs, attrs, sizeof(p->attrs));
>>>>
>>>> What about this case?
>>>> Aren't we losing the attrs?
>>>
>>> I'm not sure what you mean. Are you asking what will happen if someone
>>> sets O_EXCL without setting O_CREAT? We don't call encode_createmode at
>>> all in that case. Otherwise, see below.
>>>
>>
>> It looks like in the O_CREAT|O_EXCL case with persistent session
>> the attrs passed in to nfs4_opendata_alloc are not copied to p->attrs
>> and p->o_arg.u.attrs is not set.
>> Then later on, in encode_createmode, in the respective path, we still use it:
>> if (nfs4_has_persistent_session(clp)) {
>> *p = cpu_to_be32(NFS4_CREATE_GUARDED);
>> encode_attrs(xdr, arg->u.attrs, arg->server);
>> } else {
>>
>> Benny
>>
>>> Cheers
>>> Trond
>>>
>>>>
>>>>> - } else { /* EXCLUSIVE4_1 */
>>>>> - u32 *s = (u32 *) p->o_arg.u.verifier.data;
>>>>> - s[0] = jiffies;
>>>>> - s[1] = current->pid;
>>>>> - }
>>>>> - } else if (flags & O_CREAT) {
>>>>> + if (flags & O_CREAT) {
>>>>> + u32 *s;
>>>>> +
>>>>> p->o_arg.u.attrs = &p->attrs;
>>>>> memcpy(&p->attrs, attrs, sizeof(p->attrs));
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> Why isn't this sufficient?
>
Duh. Sorry, I missed that.
Benny
>>>>> + s = (u32 *) p->o_arg.u.verifier.data;
>>>>> + s[0] = jiffies;
>>>>> + s[1] = current->pid;
>>>>> }
>>>>> p->c_arg.fh = &p->o_res.fh;
>>>>> p->c_arg.stateid = &p->o_res.stateid;
>>>>> diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
>>>>> index 51914d7..a319cb9 100644
>>>>> --- a/include/linux/nfs_xdr.h
>>>>> +++ b/include/linux/nfs_xdr.h
>>>>> @@ -196,8 +196,10 @@ struct nfs_openargs {
>>>>> __u64 clientid;
>>>>> __u64 id;
>>>>> union {
>>>>> - struct iattr * attrs; /* UNCHECKED, GUARDED */
>>>>> - nfs4_verifier verifier; /* EXCLUSIVE */
>>>>> + struct {
>>>>> + struct iattr * attrs; /* UNCHECKED, GUARDED */
>>>>> + nfs4_verifier verifier; /* EXCLUSIVE */
>>>>> + };
>>>>> nfs4_stateid delegation; /* CLAIM_DELEGATE_CUR */
>>>>> fmode_t delegation_type; /* CLAIM_PREVIOUS */
>>>>> } u;
>>>>
>>>
>>>
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
>>> the body of a message to majordomo@vger.kernel.org
>>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2010-06-15 16:30 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-14 21:51 [PATCH 01/15] NFSv41: Fix a memory leak in nfs41_proc_async_sequence() Trond Myklebust
2010-06-14 21:51 ` [PATCH 02/15] NFSv4.1: Clean up nfs4_setup_sequence Trond Myklebust
2010-06-14 21:51 ` [PATCH 03/15] NFSv4.1: Simplify nfs41_sequence_done() Trond Myklebust
2010-06-14 21:51 ` [PATCH 04/15] NFSv4: Kill nfs4_async_handle_error() abuses by NFSv4.1 Trond Myklebust
2010-06-14 21:51 ` [PATCH 05/15] NFSv4.1: Merge the nfs41_proc_async_sequence() and nfs4_proc_sequence() Trond Myklebust
2010-06-14 21:51 ` [PATCH 06/15] NFSv4.1: Make nfs4_setup_sequence take a nfs_server argument Trond Myklebust
2010-06-14 21:51 ` [PATCH 07/15] NFSv41: Further cleanup for nfs4_sequence_done Trond Myklebust
2010-06-14 21:51 ` [PATCH 08/15] NFSv41: Don't store session state in the nfs_client->cl_state Trond Myklebust
2010-06-14 21:51 ` [PATCH 09/15] NFSv41: Clean up the NFSv4.1 minor version specific operations Trond Myklebust
2010-06-14 21:51 ` [PATCH 10/15] NFSv41: Convert the various reboot recovery ops etc to minor version ops Trond Myklebust
2010-06-14 21:51 ` [PATCH 11/15] NFSv41: Fix nfs_async_inode_return_delegation() ugliness Trond Myklebust
2010-06-14 21:51 ` [PATCH 12/15] NFSv41: Deprecate nfs_client->cl_minorversion Trond Myklebust
2010-06-14 21:51 ` [PATCH 13/15] NFSv41: Clean up exclusive create Trond Myklebust
2010-06-14 21:51 ` [PATCH 14/15] NFSv41: Cleanup for nfs4_alloc_session Trond Myklebust
2010-06-14 21:51 ` [PATCH 15/15] NFSv4.1: There is no need to init the session more than once Trond Myklebust
2010-06-14 23:13 ` [PATCH 13/15] NFSv41: Clean up exclusive create Benny Halevy
2010-06-15 15:50 ` Trond Myklebust
[not found] ` <1276617009.8767.6.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2010-06-15 16:08 ` Benny Halevy
2010-06-15 16:19 ` Trond Myklebust
[not found] ` <1276618750.8767.7.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2010-06-15 16:30 ` Benny Halevy [this message]
2010-06-15 16:50 ` [PATCH 02/15] NFSv4.1: Clean up nfs4_setup_sequence Gilliam, PaulX J
[not found] ` <0A97A441BFADC74EA1E299A79C69DF9213D49EB687-osO9UTpF0UQ64kNsxIetb7fspsVTdybXVpNB7YpNyf8@public.gmane.org>
2010-06-15 17:32 ` Trond Myklebust
2010-06-15 17:53 ` J. Bruce Fields
[not found] ` <1276623141.8767.47.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org>
2010-06-15 18:01 ` Gilliam, PaulX J
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4C17AA88.9080702@panasas.com \
--to=bhalevy@panasas.com \
--cc=Trond.Myklebust@netapp.com \
--cc=linux-nfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox