On Tue, Sep 01, 2020 at 11:22:26AM +0300, Amir Goldstein wrote: [..] > > > + int nr_elems = ARRAY_SIZE(dirty_path); > > + > > + err = 0; > > + parent = ofs->workbasedir; > > + dget(parent); > > + > > + for (i = 0; i < nr_elems; i++) { > > + name = dirty_path[i]; > > + len = strlen(name); > > + inode_lock_nested(parent->d_inode, I_MUTEX_PARENT); > > + child = lookup_one_len(name, parent, len); > > + if (IS_ERR(child)) { > > + err = PTR_ERR(child); > > + goto out_unlock; > > + } > > + > > + if (!child->d_inode) { > > + unsigned short ftype; > > + > > + ftype = (i == (nr_elems - 1)) ? S_IFREG : S_IFDIR; > > + child = ovl_create_real(parent->d_inode, child, > > + OVL_CATTR(ftype | 0)); > > + if (IS_ERR(child)) { > > + err = PTR_ERR(child); > > + goto out_unlock; > > + } > > + } > > + > > + inode_unlock(parent->d_inode); > > + dput(parent); > > + parent = child; > > + child = NULL; > > + } > > + > > + dput(parent); > > + return err; > > + > > +out_unlock: > > + inode_unlock(parent->d_inode); > > + dput(parent); > > + return err; > > +} > > + > > I think a helper ovl_test_create() along the lines of the helper found on > my ovl-features branch could make this code a lot easier to follow. > Note that the helper in that branch in not ready to be cherry-picked > as is - it needs changes, so take it or leave it. Hi Amir, For now, I will like to stick with it. You can change it down then line once ovl_test_create() is ready to be merged. Vivek