Skip to contentSkip to conversation

tmpfs: Decrement i_nlink correctly in shmem_rmdir()

PATCH New Hugh Dickins 1 participant 2 messages Jun 12, 2006 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 5 lines · Sergey Vlasov

shmem_rmdir() must undo the increment of i_nlink done in shmem_get_inode() for directories, otherwise at least IN_DELETE_SELF inotify event generation is broken.

Thanks: that is consistent with ramfs, seems correct and does no harm. Though I don't think it affects anything than the fsnotify_inoderemove i_nlink test in dentry_iput. I'm a little surprised by that test, unqualified to say whether that's the right place and way to make an inoderemove test; but even if it were not, I'd be silly to reject your fix. Thanks, I'll sign it off and send it onwards.

Hugh

Quoted 19 lines
---
 mm/shmem.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
mm/shmem.c +1 -0
index 4c5e68e..bd7bf49 100644
@@ -1780,6 +1780,7 @@ static int shmem_rmdir(struct inode *dir
 	if (!simple_empty(dentry))
 		return -ENOTEMPTY;
 
+	dentry->d_inode->i_nlink--;
 	dir->i_nlink--;
 	return shmem_unlink(dir, dentry);
 }
Signature · 1 line
1.4.0.g1658
#2 lore raw

PATCH 1/1 tmpfs: Decrement i_nlink correctly in shmem_rmdir()

From: Sergey Vlasov <[email protected]>

shmem_rmdir() must undo the increment of i_nlink done in shmem_get_inode() for directories, otherwise at least IN_DELETE_SELF inotify event generation is broken.

---
This can also be included in 2.6.17, though only inotify depends on it.

 mm/shmem.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
mm/shmem.c +1 -0
@@ -1780,6 +1780,7 @@ static int shmem_rmdir(struct inode *dir
 	if (!simple_empty(dentry))
 		return -ENOTEMPTY;
 
+	dentry->d_inode->i_nlink--;
 	dir->i_nlink--;
 	return shmem_unlink(dir, dentry);
 }