[PATCH] r/o bind mounts: monitor zeroing of i_nlink
Some filesystems, instead of simply decrementing i_nlink, simply zero it
during an unlink operation. We need to catch these in addition to the
decrement operations.
Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
Acked-by: Christoph Hellwig <hch@lst.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 6a5267d..3493d28 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1235,6 +1235,11 @@
inode->i_nlink--;
}
+static inline void clear_nlink(struct inode *inode)
+{
+ inode->i_nlink = 0;
+}
+
static inline void inode_dec_link_count(struct inode *inode)
{
drop_nlink(inode);