diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2024-04-02 20:42:32 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-04-03 17:50:23 -0400 |
commit | 4317b2e12697aa19546ddeb0710a3094907de44f (patch) | |
tree | 90d7d6ecc8642a8d83057b1f5b11e6e1afb898c3 | |
parent | 608c5050dbf4f85d8dc386782516b8514c31ced5 (diff) |
Revert "fs/9p: convert mkdir to use get_new_inode"
This reverts commit 44c53ac09720e7bc62fa1663a3b0b44306e693f0.
-rw-r--r-- | fs/9p/vfs_inode_dotl.c | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c index c9e67d7334e3..3505227e1704 100644 --- a/fs/9p/vfs_inode_dotl.c +++ b/fs/9p/vfs_inode_dotl.c @@ -402,17 +402,32 @@ static int v9fs_vfs_mkdir_dotl(struct mnt_idmap *idmap, } /* instantiate inode and assign the unopened fid to the dentry */ - inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); - if (IS_ERR(inode)) { - err = PTR_ERR(inode); - p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n", - err); - goto error; + if (v9ses->cache & (CACHE_META|CACHE_LOOSE)) { + inode = v9fs_get_new_inode_from_fid(v9ses, fid, dir->i_sb); + if (IS_ERR(inode)) { + err = PTR_ERR(inode); + p9_debug(P9_DEBUG_VFS, "inode creation failed %d\n", + err); + goto error; + } + v9fs_fid_add(dentry, &fid); + v9fs_set_create_acl(inode, fid, dacl, pacl); + d_instantiate(dentry, inode); + err = 0; + } else { + /* + * Not in cached mode. No need to populate + * inode with stat. We need to get an inode + * so that we can set the acl with dentry + */ + inode = v9fs_get_inode(dir->i_sb, mode, 0); + if (IS_ERR(inode)) { + err = PTR_ERR(inode); + goto error; + } + v9fs_set_create_acl(inode, fid, dacl, pacl); + d_instantiate(dentry, inode); } - v9fs_fid_add(dentry, &fid); - v9fs_set_create_acl(inode, fid, dacl, pacl); - d_instantiate(dentry, inode); - err = 0; inc_nlink(dir); v9fs_invalidate_inode_attr(dir); error: |