Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 267103
b: refs/heads/master
c: aadab6c
h: refs/heads/master
i:
  267101: 98f770c
  267099: daf4360
  267095: 8357033
  267087: ebbe7ca
  267071: bc4d8db
v: v3
  • Loading branch information
J. Bruce Fields committed Aug 19, 2011
1 parent f905869 commit bbf77b6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 576163005de286bbd418fcb99cfd0971523a0c6d
refs/heads/master: aadab6c6f4da38d639394de740602f146c88da0c
21 changes: 21 additions & 0 deletions trunk/fs/nfsd/nfs4proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,24 @@ do_open_permission(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfs
return status;
}

static __be32 nfsd_check_obj_isreg(struct svc_fh *fh)
{
umode_t mode = fh->fh_dentry->d_inode->i_mode;

if (S_ISREG(mode))
return nfs_ok;
if (S_ISDIR(mode))
return nfserr_isdir;
/*
* Using err_symlink as our catch-all case may look odd; but
* there's no other obvious error for this case in 4.0, and we
* happen to know that it will cause the linux v4 client to do
* the right thing on attempts to open something other than a
* regular file.
*/
return nfserr_symlink;
}

static __be32
do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open)
{
Expand Down Expand Up @@ -216,6 +234,9 @@ do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_o
status = nfsd_lookup(rqstp, current_fh,
open->op_fname.data, open->op_fname.len, &resfh);
fh_unlock(current_fh);
if (status)
goto out;
status = nfsd_check_obj_isreg(&resfh);
}
if (status)
goto out;
Expand Down

0 comments on commit bbf77b6

Please sign in to comment.