PERFORCE change 194963 for review
Ilya Putsikau
ilya at FreeBSD.org
Sun Jun 19 09:39:59 UTC 2011
http://p4web.freebsd.org/@@194963?ac=10
Change 194963 by ilya at ilya_triton2011 on 2011/06/19 09:39:49
Release and unlock vnodes in rename, check cross fs rename.
Don't check if target directory is not under the source directory,
patching fuse sould be easier.
Affected files ...
.. //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_vnops.c#20 edit
Differences ...
==== //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_vnops.c#20 (text+ko) ====
@@ -1442,18 +1442,38 @@
panic("fuse_vnop_rename(): called on a dead file system");
}
+ if (fvp->v_mount != tdvp->v_mount ||
+ (tvp && fvp->v_mount != tvp->v_mount)) {
+ DEBUG("cross-device rename: %s -> %s\n",
+ fcnp->cn_nameptr, (tcnp != NULL ? tcnp->cn_nameptr : "(NULL)"));
+ err = EXDEV;
+ goto out;
+ }
+
cache_purge(fvp);
+ /*
+ * FUSE library is expected to check if target directory is not
+ * under the source directory in the file system tree.
+ * Linux performs this check at VFS level.
+ */
err = fuse_internal_rename(fdvp, fcnp, tdvp, tcnp);
- if (tvp != NULLVP) {
- if (tvp != fvp) {
- cache_purge(tvp);
- }
- if (err == 0) {
- vrecycle(tvp, tcnp->cn_thread);
- }
+ if (tvp != NULL && tvp != fvp) {
+ cache_purge(tvp);
+ }
+
+out:
+ if (tdvp == tvp) {
+ vrele(tdvp);
+ } else {
+ vput(tdvp);
+ }
+ if (tvp != NULL) {
+ vput(tvp);
}
+ vrele(fdvp);
+ vrele(fvp);
return err;
}
More information about the p4-projects
mailing list