]> rtime.felk.cvut.cz Git - linux-imx.git/commitdiff
NFSv4: Warn once about servers that incorrectly apply open mode to setattr
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Mon, 29 Apr 2013 15:11:58 +0000 (11:11 -0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Mon, 29 Apr 2013 15:11:58 +0000 (11:11 -0400)
Debugging aid to help identify servers that incorrectly apply open mode
checks to setattr requests that are not changing the file size.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/nfs4proc.c

index 982b4527551d136fae8db1e6ee06e9ef1ccb8526..9da4bd55eb3019a964f8a7a7b0f89e2bab4c8b42 100644 (file)
@@ -2184,6 +2184,13 @@ static int nfs4_do_setattr(struct inode *inode, struct rpc_cred *cred,
                err = _nfs4_do_setattr(inode, cred, fattr, sattr, state);
                switch (err) {
                case -NFS4ERR_OPENMODE:
+                       if (!(sattr->ia_valid & ATTR_SIZE)) {
+                               pr_warn_once("NFSv4: server %s is incorrectly "
+                                               "applying open mode checks to "
+                                               "a SETATTR that is not "
+                                               "changing file size.\n",
+                                               server->nfs_client->cl_hostname);
+                       }
                        if (state && !(state->state & FMODE_WRITE)) {
                                err = -EBADF;
                                if (sattr->ia_valid & ATTR_OPEN)