On Sun, Jan 24, 2021 at 09:38:19PM -0700, Jens Axboe wrote: > On 11/15/20 9:45 PM, Dmitry Kadashev wrote: > > Pass in the struct filename pointers instead of the user string, and > > update the three callers to do the same. This is heavily based on > > commit dbea8d345177 ("fs: make do_renameat2() take struct filename"). > > > > This behaves like do_unlinkat() and do_renameat2(). > > Al, are you OK with this patch? Leaving it quoted, though you should > have the original too. > > -static long do_mkdirat(int dfd, const char __user *pathname, umode_t mode) > > +long do_mkdirat(int dfd, struct filename *name, umode_t mode) > > { > > struct dentry *dentry; > > struct path path; > > int error; > > unsigned int lookup_flags = LOOKUP_DIRECTORY; > > > > + if (IS_ERR(name)) > > + return PTR_ERR(name); > > + > > retry: > > - dentry = user_path_create(dfd, pathname, &path, lookup_flags); > > - if (IS_ERR(dentry)) > > - return PTR_ERR(dentry); > > + name->refcnt++; /* filename_create() drops our ref */ > > + dentry = filename_create(dfd, name, &path, lookup_flags); > > + if (IS_ERR(dentry)) { > > + error = PTR_ERR(dentry); > > + goto out; > > + } No. This is going to be a source of confusion from hell. If anything, you want a variant of filename_create() that does not drop name on success. With filename_create() itself being an inlined wrapper for it.