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_linkat()

similar to previous commit; replacement is filename_linkat()

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

Al Viro 037193b0 e6d50234

+20 -21
+1 -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(). 1345 + (filename_renameat2(), etc.) Replaced so far: do_renameat2(), do_linkat().
+3 -2
fs/init.c
··· 145 145 146 146 int __init init_link(const char *oldname, const char *newname) 147 147 { 148 - return do_linkat(AT_FDCWD, getname_kernel(oldname), 149 - AT_FDCWD, getname_kernel(newname), 0); 148 + CLASS(filename_kernel, old)(oldname); 149 + CLASS(filename_kernel, new)(newname); 150 + return filename_linkat(AT_FDCWD, old, AT_FDCWD, new, 0); 150 151 } 151 152 152 153 int __init init_symlink(const char *oldname, const char *newname)
+1 -1
fs/internal.h
··· 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 64 int do_symlinkat(struct filename *from, int newdfd, struct filename *to); 65 - int do_linkat(int olddfd, struct filename *old, int newdfd, 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, 68 68 const struct path *parentpath,
+12 -15
fs/namei.c
··· 5729 5729 * We don't follow them on the oldname either to be compatible 5730 5730 * with linux 2.0, and to avoid hard-linking to directories 5731 5731 * and other special files. --ADM 5732 - */ 5733 - int do_linkat(int olddfd, struct filename *old, int newdfd, 5734 - struct filename *new, int flags) 5732 + */ 5733 + int filename_linkat(int olddfd, struct filename *old, 5734 + int newdfd, struct filename *new, int flags) 5735 5735 { 5736 5736 struct mnt_idmap *idmap; 5737 5737 struct dentry *new_dentry; ··· 5740 5740 int how = 0; 5741 5741 int error; 5742 5742 5743 - if ((flags & ~(AT_SYMLINK_FOLLOW | AT_EMPTY_PATH)) != 0) { 5744 - error = -EINVAL; 5745 - goto out_putnames; 5746 - } 5743 + if ((flags & ~(AT_SYMLINK_FOLLOW | AT_EMPTY_PATH)) != 0) 5744 + return -EINVAL; 5747 5745 /* 5748 5746 * To use null names we require CAP_DAC_READ_SEARCH or 5749 5747 * that the open-time creds of the dfd matches current. ··· 5756 5758 retry: 5757 5759 error = filename_lookup(olddfd, old, how, &old_path, NULL); 5758 5760 if (error) 5759 - goto out_putnames; 5761 + return error; 5760 5762 5761 5763 new_dentry = filename_create(newdfd, new, &new_path, 5762 5764 (how & LOOKUP_REVAL)); ··· 5792 5794 } 5793 5795 out_putpath: 5794 5796 path_put(&old_path); 5795 - out_putnames: 5796 - putname(old); 5797 - putname(new); 5798 - 5799 5797 return error; 5800 5798 } 5801 5799 5802 5800 SYSCALL_DEFINE5(linkat, int, olddfd, const char __user *, oldname, 5803 5801 int, newdfd, const char __user *, newname, int, flags) 5804 5802 { 5805 - return do_linkat(olddfd, getname_uflags(oldname, flags), 5806 - newdfd, getname(newname), flags); 5803 + CLASS(filename_uflags, old)(oldname, flags); 5804 + CLASS(filename, new)(newname); 5805 + return filename_linkat(olddfd, old, newdfd, new, flags); 5807 5806 } 5808 5807 5809 5808 SYSCALL_DEFINE2(link, const char __user *, oldname, const char __user *, newname) 5810 5809 { 5811 - return do_linkat(AT_FDCWD, getname(oldname), AT_FDCWD, getname(newname), 0); 5810 + CLASS(filename, old)(oldname); 5811 + CLASS(filename, new)(newname); 5812 + return filename_linkat(AT_FDCWD, old, AT_FDCWD, new, 0); 5812 5813 } 5813 5814 5814 5815 /**
+3 -2
io_uring/fs.c
··· 280 280 int io_linkat(struct io_kiocb *req, unsigned int issue_flags) 281 281 { 282 282 struct io_link *lnk = io_kiocb_to_cmd(req, struct io_link); 283 + CLASS(filename_complete_delayed, old)(&lnk->oldpath); 284 + CLASS(filename_complete_delayed, new)(&lnk->newpath); 283 285 int ret; 284 286 285 287 WARN_ON_ONCE(issue_flags & IO_URING_F_NONBLOCK); 286 288 287 - ret = do_linkat(lnk->old_dfd, complete_getname(&lnk->oldpath), 288 - lnk->new_dfd, complete_getname(&lnk->newpath), lnk->flags); 289 + ret = filename_linkat(lnk->old_dfd, old, lnk->new_dfd, new, lnk->flags); 289 290 290 291 req->flags &= ~REQ_F_NEED_CLEANUP; 291 292 io_req_set_res(req, ret, 0);