diff options
Diffstat (limited to 'fs/nfsd/vfs.c')
| -rw-r--r-- | fs/nfsd/vfs.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index a6bc8a7423db..8ff6a0019b0b 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
| @@ -28,6 +28,7 @@ | |||
| 28 | #include <asm/uaccess.h> | 28 | #include <asm/uaccess.h> |
| 29 | #include <linux/exportfs.h> | 29 | #include <linux/exportfs.h> |
| 30 | #include <linux/writeback.h> | 30 | #include <linux/writeback.h> |
| 31 | #include <linux/security.h> | ||
| 31 | 32 | ||
| 32 | #ifdef CONFIG_NFSD_V3 | 33 | #ifdef CONFIG_NFSD_V3 |
| 33 | #include "xdr3.h" | 34 | #include "xdr3.h" |
| @@ -621,6 +622,33 @@ int nfsd4_is_junction(struct dentry *dentry) | |||
| 621 | return 0; | 622 | return 0; |
| 622 | return 1; | 623 | return 1; |
| 623 | } | 624 | } |
| 625 | #ifdef CONFIG_NFSD_V4_SECURITY_LABEL | ||
| 626 | __be32 nfsd4_set_nfs4_label(struct svc_rqst *rqstp, struct svc_fh *fhp, | ||
| 627 | struct xdr_netobj *label) | ||
| 628 | { | ||
| 629 | __be32 error; | ||
| 630 | int host_error; | ||
| 631 | struct dentry *dentry; | ||
| 632 | |||
| 633 | error = fh_verify(rqstp, fhp, 0 /* S_IFREG */, NFSD_MAY_SATTR); | ||
| 634 | if (error) | ||
| 635 | return error; | ||
| 636 | |||
| 637 | dentry = fhp->fh_dentry; | ||
| 638 | |||
| 639 | mutex_lock(&dentry->d_inode->i_mutex); | ||
| 640 | host_error = security_inode_setsecctx(dentry, label->data, label->len); | ||
| 641 | mutex_unlock(&dentry->d_inode->i_mutex); | ||
| 642 | return nfserrno(host_error); | ||
| 643 | } | ||
| 644 | #else | ||
| 645 | __be32 nfsd4_set_nfs4_label(struct svc_rqst *rqstp, struct svc_fh *fhp, | ||
| 646 | struct xdr_netobj *label) | ||
| 647 | { | ||
| 648 | return nfserr_notsupp; | ||
| 649 | } | ||
| 650 | #endif | ||
| 651 | |||
| 624 | #endif /* defined(CONFIG_NFSD_V4) */ | 652 | #endif /* defined(CONFIG_NFSD_V4) */ |
| 625 | 653 | ||
| 626 | #ifdef CONFIG_NFSD_V3 | 654 | #ifdef CONFIG_NFSD_V3 |
