nfsd: print status when nfsd4_open fails to open file it just created
authorJeff Layton <jlayton@primarydata.com>
Wed, 30 Jul 2014 01:37:44 +0000 (21:37 -0400)
committerJ. Bruce Fields <bfields@redhat.com>
Wed, 30 Jul 2014 03:08:38 +0000 (23:08 -0400)
It's possible for nfsd to fail opening a file that it has just created.
When that happens, we throw a WARN but it doesn't include any info about
the error code. Print the status code to give us a bit more info.

Our QA group hit some of these warnings under some very heavy stress
testing. My suspicion is that they hit the file-max limit, but it's hard
to know for sure. Go ahead and add a -ENFILE mapping to
nfserr_serverfault to make the error more distinct (and correct).

Signed-off-by: Jeff Layton <jlayton@primarydata.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/nfs4proc.c
fs/nfsd/nfsproc.c

index 29a617ebe38c95030b7f0280810fd45da4720534..8611585f739d0bfd0b2771adfcb41ae73f1b2daf 100644 (file)
@@ -460,7 +460,9 @@ nfsd4_open(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
         * set, (2) sets open->op_stateid, (3) sets open->op_delegation.
         */
        status = nfsd4_process_open2(rqstp, resfh, open);
-       WARN_ON(status && open->op_created);
+       WARN(status && open->op_created,
+            "nfsd4_process_open2 failed to open newly-created file! status=%u\n",
+            be32_to_cpu(status));
 out:
        if (resfh && resfh != &cstate->current_fh) {
                fh_dup2(&cstate->current_fh, resfh);
index b19c7e8bf64c2cc14366658dd35184448e20270e..b8680738f5884e7ee94d46c95c89ff68faa9a95f 100644 (file)
@@ -745,6 +745,7 @@ nfserrno (int errno)
                { nfserr_notsupp, -EOPNOTSUPP },
                { nfserr_toosmall, -ETOOSMALL },
                { nfserr_serverfault, -ESERVERFAULT },
+               { nfserr_serverfault, -ENFILE },
        };
        int     i;