On Mon, Dec 23, 2024 at 11:04:58PM -0500, James Bottomley wrote: > +static int efivarfs_file_release(struct inode *inode, struct file *file) > +{ > + if (i_size_read(inode) == 0) > + simple_recursive_removal(file->f_path.dentry, NULL); > + > + return 0; > +} What happens if you have fd = creat(name, 0700); fd2 = open(name, O_RDONLY); close(fd2); write(fd, "barf", 4); or, better yet, if open()/close() pair happens in an unrelated thread poking around? I mean, having that logics in ->release() feels very awkward... For that matter, what about fd = creat(name, 0700); fd2 = open(name, O_RDWR); close(fd); write(fd2, "barf", 4); I'm not asking about the implementation; what behaviour do you want to see in userland?