fs/nfsd/nfs3acl.c
Source file repositories/reference/linux-study-clean/fs/nfsd/nfs3acl.c
File Facts
- System
- Linux kernel
- Corpus path
fs/nfsd/nfs3acl.c- Extension
.c- Size
- 7069 bytes
- Lines
- 287
- Domain
- Core OS
- Bucket
- VFS And Filesystem Core
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
nfsd.hlinux/nfsacl.hlinux/gfp.hcache.hxdr3.hvfs.h
Detected Declarations
function Copyrightfunction nfsd3_proc_getaclfunction nfsd3_proc_setaclfunction nfs3svc_decode_getaclargsfunction nfs3svc_decode_setaclargsfunction nfs3svc_encode_getaclresfunction nfs3svc_encode_setaclresfunction nfs3svc_release_getaclfunction nfs3svc_release_setacl
Annotated Snippet
if (acl == NULL) {
/* Solaris returns the inode's minimum ACL. */
acl = posix_acl_from_mode(inode->i_mode, GFP_KERNEL);
}
if (IS_ERR(acl)) {
resp->status = nfserrno(PTR_ERR(acl));
goto fail;
}
resp->acl_access = acl;
}
if (resp->mask & (NFS_DFACL|NFS_DFACLCNT)) {
/* Check how Solaris handles requests for the Default ACL
of a non-directory! */
acl = get_inode_acl(inode, ACL_TYPE_DEFAULT);
if (IS_ERR(acl)) {
resp->status = nfserrno(PTR_ERR(acl));
goto fail;
}
resp->acl_default = acl;
}
/* resp->acl_{access,default} are released in nfs3svc_release_getacl. */
out:
return rpc_success;
fail:
posix_acl_release(resp->acl_access);
posix_acl_release(resp->acl_default);
resp->acl_access = NULL;
resp->acl_default = NULL;
goto out;
}
/*
* Set the Access and/or Default ACL of a file.
*/
static __be32 nfsd3_proc_setacl(struct svc_rqst *rqstp)
{
struct nfsd3_setaclargs *argp = rqstp->rq_argp;
struct nfsd3_attrstat *resp = rqstp->rq_resp;
struct inode *inode;
svc_fh *fh;
int error;
fh = fh_copy(&resp->fh, &argp->fh);
resp->status = fh_verify(rqstp, &resp->fh, 0, NFSD_MAY_SATTR);
if (resp->status != nfs_ok)
goto out;
inode = d_inode(fh->fh_dentry);
error = fh_want_write(fh);
if (error)
goto out_errno;
inode_lock(inode);
error = set_posix_acl(&nop_mnt_idmap, fh->fh_dentry, ACL_TYPE_ACCESS,
argp->acl_access);
if (error)
goto out_drop_lock;
error = set_posix_acl(&nop_mnt_idmap, fh->fh_dentry, ACL_TYPE_DEFAULT,
argp->acl_default);
out_drop_lock:
inode_unlock(inode);
fh_drop_write(fh);
out_errno:
resp->status = nfserrno(error);
out:
/* argp->acl_{access,default} are released in nfs3svc_release_setacl. */
return rpc_success;
}
/*
* XDR decode functions
*/
static bool
nfs3svc_decode_getaclargs(struct svc_rqst *rqstp, struct xdr_stream *xdr)
{
struct nfsd3_getaclargs *args = rqstp->rq_argp;
if (!svcxdr_decode_nfs_fh3(xdr, &args->fh))
return false;
if (xdr_stream_decode_u32(xdr, &args->mask) < 0)
return false;
return true;
}
Annotation
- Immediate include surface: `nfsd.h`, `linux/nfsacl.h`, `linux/gfp.h`, `cache.h`, `xdr3.h`, `vfs.h`.
- Detected declarations: `function Copyright`, `function nfsd3_proc_getacl`, `function nfsd3_proc_setacl`, `function nfs3svc_decode_getaclargs`, `function nfs3svc_decode_setaclargs`, `function nfs3svc_encode_getaclres`, `function nfs3svc_encode_setaclres`, `function nfs3svc_release_getacl`, `function nfs3svc_release_setacl`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.