On Mon, 12 Jul 2010 10:05:39 +0200, Miklos Szeredi <miklos@xxxxxxxxxx> wrote: > On Mon, 12 Jul 2010, Aneesh Kumar K.V wrote: > > This enables to use linkat to create hardlinks from a > > file descriptor pointing to the file. This can be used > > with open_by_handle syscall that returns a file descriptor. > > This needs more thought, filesystems don't usually tolerate > resurrecting a file which has already been unlinked (i_nlink == 0). > We get -ENOENT error when we do that on ext* open("test", O_RDONLY) = 3 unlink("test") = 0 linkat(3, NULL, AT_FDCWD, "test3", 0) = -1 ENOENT (No such file or directory) ext4_link does the below /* * Return -ENOENT if we've raced with unlink and i_nlink is 0. Doing * otherwise has the potential to corrupt the orphan inode list. */ if (inode->i_nlink == 0) return -ENOENT; I can move this check to VFS so that we do it for all file systems. -aneesh -- 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