How to handle non-local renames?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Consider the scenario where systems A and B share a filesystem mounted
on /mnt.

A: cd /mnt/a/b
B: mv /mnt/a/b /mnt/a/c/d
A: ls /mnt/a/c/d

So in third step the lookup returns a cached inode, to which a cached
dentry with positive refcount already refers.

I can basically think of two possibilities:

  1) instantiate new dentry 'd' with the inode
  2) move the old dentry 'b' to the new dentry 'd'

With 1, there's a problem of directory aliasing, which means the VFS
doesn't ensure any more that directory loops can't happen.  NFS looks
like it does this, and relies on the server to avoid loops.

2 suffers from locking problems, since lookup already holds a i_mutex
on /mnt/a/c so it can't acquire either the rename_mutex or i_mutex on
/mnt/a which would be needed to safely move the dentry.

Now if a new object is created at /mnt/a/b

B: touch /mnt/a/b
A: ls /mnt/a/b

In case of 1 the old dentry will have to be unhashed and replaced with
the new object.  This means that some things will no longer work for
processes using the old dentry as CWD.  In NFS we'd get a nice ESTALE
error.

Does somebody have any thoughts on this?  Could this be done in a
better way?

Thanks,
Miklos
-
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux