On Wed, Dec 13, 2017 at 1:22 PM, Chengguang Xu <cgxu519@xxxxxxxxxx> wrote: > >> 在 2017年12月12日,下午7:12,Amir Goldstein <amir73il@xxxxxxxxx> 写道: >> >> On Mon, Nov 27, 2017 at 7:58 PM, Amir Goldstein <amir73il@xxxxxxxxx> wrote: >>> On Mon, Nov 27, 2017 at 5:36 PM, cgxu <cgxu@xxxxxxxxxxxx> wrote: >>>> Hi Miklos >>>> >>>> Any suggestion for the patch? >>>> >>>> >>>> Best Regards, >>>> Chengguang >>>> >>>> >>>> >>>>> 在 2017年11月13日,下午11:59,Chengguang Xu <cgxu@xxxxxxxxxxxx> 写道: >>>>> >>>>> When upperdir has project quota and has different project id with workdir, >>>>> write may fail with error message "Invalid cross-device link" although mounted on r/w mode. >>>>> This patch checks project quota information of upperdir/workdir during ovl_fill_super(), >>>>> and if different mount on r/o mode. It doesn’t check detail inherit flag because >>>>> the implementations are different in specific filesystems. >>>>> >>> >>> Since overlayfs removes and re-creates 'work' directory inside workdir, >>> why not set projid of 'work' directory according to upper projid instead of >>> failing the mount? >>> If projid cannot be set, 'work' dir creation will fail and overlayfs will >>> fall back to ro mount anyway. >>> >> >> How about, instead of comparing project id, check that an O_TMPFILE >> created in upperdir can be moved to workdir? >> This tests exactly what overlayfs needs and not properties that lead to >> what overlayfs needs. >> Same as the check for setxattr and ovl_check_d_type_supported() >> in ovl_make_workdir(). > > Your suggestion is good as a method of warning. > But what overlays does is moving files from workdir to upperdir rather than > doing the opposite. Additionally printing out the error message of moving files > from upperdir to workdir would probably get users confused. > > I am assuming the ability to rename from upper to work is symetric and tightly coupled with the ability to link a file between upper and work, as is the case with upper/work having different projid. The error to user should be something along the lines of "cannot move files between workdir and upperdir". I miswrote in my previous email about moving a tempfile. What I meant to write was, in ovl_make_workdir(): // open an O_TMPFILE wirh upper root dir projid: uppertemp = ovl_do_tmpfile(ofs->upper_mnt, S_IFREG | 0); // try to link tmpfile to workdir (so if leftovers are not cleaned they are not in upperdir): worktemp = ovl_lookup_temp(ofs->workdir); err = ovl_do_link(uppertemp, ofs->workdir, worktemp, true); ovl_cleanup(ofs->workdir, worktemp); Amir. -- To unsubscribe from this list: send the line "unsubscribe linux-unionfs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html