@@ -69,6 +69,17 @@ nfsd_mode_check(struct svc_rqst *rqstp, umode_t mode, int type)
return nfserr_notdir;
else if ((mode & S_IFMT) == S_IFDIR)
return nfserr_isdir;
+ /*
+ * err_symlink is our catch-all error in the v4 case; this
+ * looks odd, but:
+ * - the comment next to ERR_SYMLINK in file is
+ * "should be file/directory"
+ * - we happen to know this will cause the linux v4
+ * client to do the right thing on attempts to open
+ * something other than a regular file:
+ */
+ else if (rqstp->rq_vers == 4)
+ return nfserr_symlink;
else
return nfserr_inval;
}
Without this, an attempt to open a device special file without first stat'ing it will fail. Signed-off-by: J. Bruce Fields <bfields@redhat.com> --- fs/nfsd/nfsfh.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-)