// SPDX-License-Identifier: GPL-2.0-or-later /* getroot.c: get the root dentry for an NFS mount * *Copyright(C)2006RedHat,Inc.AllRightsReserved. *WrittenbyDavidHowells(dhowells@redhat.com)
*/
inode = nfs_fhget(s, ctx->mntfh, fsinfo.fattr); if (IS_ERR(inode)) {
dprintk("nfs_get_root: get root inode failed\n");
error = PTR_ERR(inode);
nfs_errorf(fc, "NFS: Couldn't get root inode"); goto out_fattr;
}
error = nfs_superblock_set_dummy_root(s, inode); if (error != 0) goto out_fattr;
/* root dentries normally start off anonymous and get spliced in later *ifthedentrytreereachesthem;howeverifthedentryalready *exists,we'llpickitupatthispointanduseitastheroot
*/
root = d_obtain_root(inode); if (IS_ERR(root)) {
dprintk("nfs_get_root: get root dentry failed\n");
error = PTR_ERR(root);
nfs_errorf(fc, "NFS: Couldn't get root dentry"); goto out_fattr;
}
security_d_instantiate(root, inode);
spin_lock(&root->d_lock); if (IS_ROOT(root) && !root->d_fsdata &&
!(root->d_flags & DCACHE_NFSFS_RENAMED)) {
root->d_fsdata = name;
name = NULL;
}
spin_unlock(&root->d_lock);
fc->root = root; if (server->caps & NFS_CAP_SECURITY_LABEL)
kflags |= SECURITY_LSM_NATIVE_LABELS; if (ctx->clone_data.sb) { if (d_inode(fc->root)->i_fop != &nfs_dir_operations) {
error = -ESTALE; goto error_splat_root;
} /* clone lsm security options from the parent to the new sb */
error = security_sb_clone_mnt_opts(ctx->clone_data.sb,
s, kflags, &kflags_out); if (error) goto error_splat_root;
clone_server = NFS_SB(ctx->clone_data.sb);
server->has_sec_mnt_opts = clone_server->has_sec_mnt_opts;
} else {
error = security_sb_set_mnt_opts(s, fc->security,
kflags, &kflags_out);
} if (error) goto error_splat_root; if (server->caps & NFS_CAP_SECURITY_LABEL &&
!(kflags_out & SECURITY_LSM_NATIVE_LABELS))
server->caps &= ~NFS_CAP_SECURITY_LABEL;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.