On Fri, Nov 06, 2020 at 01:27:51PM +0000, Pavel Begunkov wrote: > On 06/11/2020 13:15, Dmitry Kadashev wrote: > > On Fri, Nov 06, 2020 at 12:49:05PM +0000, Pavel Begunkov wrote: > >> On 06/11/2020 10:08, Dmitry Kadashev wrote: > >>> On Thu, Nov 05, 2020 at 08:57:43PM +0000, Pavel Begunkov wrote: > >>> That's pretty much what do_unlinkat() does btw. Thanks Pavel for looking > >>> into this! > >>> > >>> Can I pick your brain some more? do_mkdirat() case is slightly > >>> different: > >>> > >>> static long do_mkdirat(int dfd, const char __user *pathname, umode_t mode) > >>> { > >>> struct dentry *dentry; > >>> struct path path; > >>> int error; > >>> unsigned int lookup_flags = LOOKUP_DIRECTORY; > >>> > >>> retry: > >>> dentry = user_path_create(dfd, pathname, &path, lookup_flags); > >>> > >>> If we just change @pathname to struct filename, then user_path_create > >>> can be swapped for filename_create(). But the same problem on retry > >>> arises. Is there some more or less "idiomatic" way to solve this? > >> > >> I don't think there is, fs guys may have a different opinion but > >> sometimes it's hard to get through them. > >> > >> I'd take a filename reference before "retry:" > > > > How do I do that? Just `++name.refcnt` or is there a helper function / > > better way? > > I don't know, take a look around if there is one. In the end, a review and > guys familiar with this code will hopefully suggest a better way (if any). OK, thanks Pavel! I'll look around. -- Dmitry