Re: query re unlink() ... inotify ... open() race

2015-09-11 Thread Al Viro
On Sat, Sep 12, 2015 at 01:28:27AM +0100, Pádraig Brady wrote: > The open() succeeding is surprising. Is that allowed? > The summary of the sequence in the kernel is: > > vfs_unlink() { > mutex_lock(&(dentry->d_inode->i_mutex)); > security_inode_unlink(dir, dentry); > try_break_dele

query re unlink() ... inotify ... open() race

2015-09-11 Thread Pádraig Brady
Hi, We're noticing a rare race here with open() in tail(1), where this happens: tail --follow=name "file" /* "file" is unlinked() by another process */ read(IN_ATTRIB from inotify); /* for st_nlink-- */ open("file") /* Done to check if deleted, but this succeeds! */ The open() succ