NFSv4: Warn once about servers that incorrectly apply open mode to setattr

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>
This commit is contained in:
Trond Myklebust 2013-04-29 11:11:58 -04:00
parent ee3ae84ef4
commit 721ccfb79b

View 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); err = _nfs4_do_setattr(inode, cred, fattr, sattr, state);
switch (err) { switch (err) {
case -NFS4ERR_OPENMODE: 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)) { if (state && !(state->state & FMODE_WRITE)) {
err = -EBADF; err = -EBADF;
if (sattr->ia_valid & ATTR_OPEN) if (sattr->ia_valid & ATTR_OPEN)