leaves after itself two dentries - negative one ("file") and dentry ofdirectory "dir" which is attached to inode of that directory?

After that a process may get into somefs_delete_inode trying to freepages by shrinking dcache (it will first free negative dentry and thenits parent).If process is doing that being already in somefs_write (for example)some filesystems may have problems.