2014-02-23 16:22:25

by Mkrtchyan, Tigran

[permalink] [raw]
Subject:

to me it's unclear, why a SETATTR always follows an OPEN, even in case of
EXCLUSIVE4_1. With this fix, I get desired behavior.

Tigran.



2014-02-23 18:04:15

by Mkrtchyan, Tigran

[permalink] [raw]
Subject: Re:



----- Original Message -----
> From: "Trond Myklebust" <[email protected]>
> To: "Tigran Mkrtchyan" <[email protected]>
> Cc: "Linux NFS Mailing List" <[email protected]>
> Sent: Sunday, February 23, 2014 5:41:26 PM
> Subject: Re:
>
>
> On Feb 23, 2014, at 11:22, [email protected] wrote:
>
> > to me it's unclear, why a SETATTR always follows an OPEN, even in case of
> > EXCLUSIVE4_1. With this fix, I get desired behavior.
>
> Yes, but that fix risks incurring an NFS4ERR_INVAL from which we cannot
> recover because it does not include the mandatory check for the allowed set
> of attributes.
> Please see RFC5661 section 18.16.3 about the client side use of
> ‘suppattr_exclcreat’ .

Yes, I noticed, that client never query that attribute. I will check a
possibility to add a check for suppattr_exclcreat as well.

Tigran.

>
> Cheers,
> Trond

2014-02-23 16:41:28

by Trond Myklebust

[permalink] [raw]
Subject: Re:


On Feb 23, 2014, at 11:22, [email protected] wrote:

> to me it's unclear, why a SETATTR always follows an OPEN, even in case of
> EXCLUSIVE4_1. With this fix, I get desired behavior.

Yes, but that fix risks incurring an NFS4ERR_INVAL from which we cannot recover because it does not include the mandatory check for the allowed set of attributes.
Please see RFC5661 section 18.16.3 about the client side use of ?suppattr_exclcreat? .

Cheers,
Trond

2014-02-23 16:22:23

by Mkrtchyan, Tigran

[permalink] [raw]
Subject: [PATCH] nfs4: EXCLUSIVE4_1 should send file attrs with OPEN

From: Tigran Mkrtchyan <[email protected]>

to avoid extra SETATTR RPC call.

Signed-off-by: Tigran Mkrtchyan <[email protected]>
---
fs/nfs/nfs4proc.c | 2 +-
fs/nfs/nfs4xdr.c | 4 +---
2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 2da6a69..f22a72d 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -2259,7 +2259,7 @@ static int _nfs4_do_open(struct inode *dir,
state = ctx->state;

if ((opendata->o_arg.open_flags & O_EXCL) &&
- (opendata->o_arg.createmode != NFS4_CREATE_GUARDED)) {
+ (opendata->o_arg.createmode == NFS4_CREATE_EXCLUSIVE)) {
nfs4_exclusive_attrset(opendata, sattr);

nfs_fattr_init(opendata->o_res.f_attr);
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 72f3bf1..cb4dc01 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -1399,7 +1399,6 @@ static inline void encode_openhdr(struct xdr_stream *xdr, const struct nfs_opena

static inline void encode_createmode(struct xdr_stream *xdr, const struct nfs_openargs *arg)
{
- struct iattr dummy;
__be32 *p;

p = reserve_space(xdr, 4);
@@ -1419,8 +1418,7 @@ static inline void encode_createmode(struct xdr_stream *xdr, const struct nfs_op
case NFS4_CREATE_EXCLUSIVE4_1:
*p = cpu_to_be32(NFS4_CREATE_EXCLUSIVE4_1);
encode_nfs4_verifier(xdr, &arg->u.verifier);
- dummy.ia_valid = 0;
- encode_attrs(xdr, &dummy, arg->label, arg->server);
+ encode_attrs(xdr, arg->u.attrs, arg->label, arg->server);
}
}

--
1.8.5.3