Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

non-consuming variant of do_symlinkat()

similar to previous commit; replacement is filename_symlinkat()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro da72b76a 037193b0

+20 -18
+2 -1
Documentation/filesystems/porting.rst
··· 1342 1342 fs/namei.c primitives that consume filesystem references (do_renameat2(), 1343 1343 do_linkat(), do_symlinkat(), do_mkdirat(), do_mknodat(), do_unlinkat() 1344 1344 and do_rmdir()) are getting replaced with non-consuming analogues 1345 - (filename_renameat2(), etc.) Replaced so far: do_renameat2(), do_linkat(). 1345 + (filename_renameat2(), etc.) Replaced so far: do_renameat2(), do_linkat(), 1346 + do_symlinkat().
+3 -2
fs/init.c
··· 152 152 153 153 int __init init_symlink(const char *oldname, const char *newname) 154 154 { 155 - return do_symlinkat(getname_kernel(oldname), AT_FDCWD, 156 - getname_kernel(newname)); 155 + CLASS(filename_kernel, old)(oldname); 156 + CLASS(filename_kernel, new)(newname); 157 + return filename_symlinkat(old, AT_FDCWD, new); 157 158 } 158 159 159 160 int __init init_unlink(const char *pathname)
+1 -1
fs/internal.h
··· 61 61 struct filename *newname, unsigned int flags); 62 62 int do_mkdirat(int dfd, struct filename *name, umode_t mode); 63 63 int do_mknodat(int dfd, struct filename *name, umode_t mode, unsigned int dev); 64 - int do_symlinkat(struct filename *from, int newdfd, struct filename *to); 64 + int filename_symlinkat(struct filename *from, int newdfd, struct filename *to); 65 65 int filename_linkat(int olddfd, struct filename *old, int newdfd, 66 66 struct filename *new, int flags); 67 67 int vfs_tmpfile(struct mnt_idmap *idmap,
+11 -12
fs/namei.c
··· 5581 5581 } 5582 5582 EXPORT_SYMBOL(vfs_symlink); 5583 5583 5584 - int do_symlinkat(struct filename *from, int newdfd, struct filename *to) 5584 + int filename_symlinkat(struct filename *from, int newdfd, struct filename *to) 5585 5585 { 5586 5586 int error; 5587 5587 struct dentry *dentry; ··· 5589 5589 unsigned int lookup_flags = 0; 5590 5590 struct delegated_inode delegated_inode = { }; 5591 5591 5592 - if (IS_ERR(from)) { 5593 - error = PTR_ERR(from); 5594 - goto out_putnames; 5595 - } 5592 + if (IS_ERR(from)) 5593 + return PTR_ERR(from); 5594 + 5596 5595 retry: 5597 5596 dentry = filename_create(newdfd, to, &path, lookup_flags); 5598 - error = PTR_ERR(dentry); 5599 5597 if (IS_ERR(dentry)) 5600 - goto out_putnames; 5598 + return PTR_ERR(dentry); 5601 5599 5602 5600 error = security_path_symlink(&path, dentry, from->name); 5603 5601 if (!error) ··· 5611 5613 lookup_flags |= LOOKUP_REVAL; 5612 5614 goto retry; 5613 5615 } 5614 - out_putnames: 5615 - putname(to); 5616 - putname(from); 5617 5616 return error; 5618 5617 } 5619 5618 5620 5619 SYSCALL_DEFINE3(symlinkat, const char __user *, oldname, 5621 5620 int, newdfd, const char __user *, newname) 5622 5621 { 5623 - return do_symlinkat(getname(oldname), newdfd, getname(newname)); 5622 + CLASS(filename, old)(oldname); 5623 + CLASS(filename, new)(newname); 5624 + return filename_symlinkat(old, newdfd, new); 5624 5625 } 5625 5626 5626 5627 SYSCALL_DEFINE2(symlink, const char __user *, oldname, const char __user *, newname) 5627 5628 { 5628 - return do_symlinkat(getname(oldname), AT_FDCWD, getname(newname)); 5629 + CLASS(filename, old)(oldname); 5630 + CLASS(filename, new)(newname); 5631 + return filename_symlinkat(old, AT_FDCWD, new); 5629 5632 } 5630 5633 5631 5634 /**
+3 -2
io_uring/fs.c
··· 233 233 int io_symlinkat(struct io_kiocb *req, unsigned int issue_flags) 234 234 { 235 235 struct io_link *sl = io_kiocb_to_cmd(req, struct io_link); 236 + CLASS(filename_complete_delayed, old)(&sl->oldpath); 237 + CLASS(filename_complete_delayed, new)(&sl->newpath); 236 238 int ret; 237 239 238 240 WARN_ON_ONCE(issue_flags & IO_URING_F_NONBLOCK); 239 241 240 - ret = do_symlinkat(complete_getname(&sl->oldpath), sl->new_dfd, 241 - complete_getname(&sl->newpath)); 242 + ret = filename_symlinkat(old, sl->new_dfd, new); 242 243 243 244 req->flags &= ~REQ_F_NEED_CLEANUP; 244 245 io_req_set_res(req, ret, 0);