diff options
author | Dave Hansen <haveblue@us.ibm.com> | 2006-10-01 02:29:03 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-01 03:39:30 -0400 |
commit | 9a53c3a783c2fa9b969628e65695c11c3e51e673 (patch) | |
tree | 5a6115e18ee105246d46e3db3d5b07749d232f5b /drivers/usb | |
parent | aab520e2f6c80160cabd187a8d0292d1cec8ff68 (diff) |
[PATCH] r/o bind mounts: unlink: monitor i_nlink
When a filesystem decrements i_nlink to zero, it means that a write must be
performed in order to drop the inode from the filesystem.
We're shortly going to have keep filesystems from being remounted r/o between
the time that this i_nlink decrement and that write occurs.
So, add a little helper function to do the decrements. We'll tie into it in a
bit to note when i_nlink hits zero.
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>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/core/inode.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/usb/core/inode.c b/drivers/usb/core/inode.c index df3d152f0493..88002e45a6b4 100644 --- a/drivers/usb/core/inode.c +++ b/drivers/usb/core/inode.c | |||
@@ -332,7 +332,7 @@ static int usbfs_unlink (struct inode *dir, struct dentry *dentry) | |||
332 | { | 332 | { |
333 | struct inode *inode = dentry->d_inode; | 333 | struct inode *inode = dentry->d_inode; |
334 | mutex_lock(&inode->i_mutex); | 334 | mutex_lock(&inode->i_mutex); |
335 | dentry->d_inode->i_nlink--; | 335 | drop_nlink(dentry->d_inode); |
336 | dput(dentry); | 336 | dput(dentry); |
337 | mutex_unlock(&inode->i_mutex); | 337 | mutex_unlock(&inode->i_mutex); |
338 | d_delete(dentry); | 338 | d_delete(dentry); |
@@ -347,10 +347,11 @@ static int usbfs_rmdir(struct inode *dir, struct dentry *dentry) | |||
347 | mutex_lock(&inode->i_mutex); | 347 | mutex_lock(&inode->i_mutex); |
348 | dentry_unhash(dentry); | 348 | dentry_unhash(dentry); |
349 | if (usbfs_empty(dentry)) { | 349 | if (usbfs_empty(dentry)) { |
350 | dentry->d_inode->i_nlink -= 2; | 350 | drop_nlink(dentry->d_inode); |
351 | drop_nlink(dentry->d_inode); | ||
351 | dput(dentry); | 352 | dput(dentry); |
352 | inode->i_flags |= S_DEAD; | 353 | inode->i_flags |= S_DEAD; |
353 | dir->i_nlink--; | 354 | drop_nlink(dir); |
354 | error = 0; | 355 | error = 0; |
355 | } | 356 | } |
356 | mutex_unlock(&inode->i_mutex); | 357 | mutex_unlock(&inode->i_mutex); |