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 /mm/shmem.c | |
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 'mm/shmem.c')
-rw-r--r-- | mm/shmem.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/mm/shmem.c b/mm/shmem.c index b96de69f236b..908dd947b1ea 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -1772,7 +1772,7 @@ static int shmem_unlink(struct inode *dir, struct dentry *dentry) | |||
1772 | 1772 | ||
1773 | dir->i_size -= BOGO_DIRENT_SIZE; | 1773 | dir->i_size -= BOGO_DIRENT_SIZE; |
1774 | inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME; | 1774 | inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME; |
1775 | inode->i_nlink--; | 1775 | drop_nlink(inode); |
1776 | dput(dentry); /* Undo the count from "create" - this does all the work */ | 1776 | dput(dentry); /* Undo the count from "create" - this does all the work */ |
1777 | return 0; | 1777 | return 0; |
1778 | } | 1778 | } |
@@ -1782,8 +1782,8 @@ static int shmem_rmdir(struct inode *dir, struct dentry *dentry) | |||
1782 | if (!simple_empty(dentry)) | 1782 | if (!simple_empty(dentry)) |
1783 | return -ENOTEMPTY; | 1783 | return -ENOTEMPTY; |
1784 | 1784 | ||
1785 | dentry->d_inode->i_nlink--; | 1785 | drop_nlink(dentry->d_inode); |
1786 | dir->i_nlink--; | 1786 | drop_nlink(dir); |
1787 | return shmem_unlink(dir, dentry); | 1787 | return shmem_unlink(dir, dentry); |
1788 | } | 1788 | } |
1789 | 1789 | ||
@@ -1804,9 +1804,9 @@ static int shmem_rename(struct inode *old_dir, struct dentry *old_dentry, struct | |||
1804 | if (new_dentry->d_inode) { | 1804 | if (new_dentry->d_inode) { |
1805 | (void) shmem_unlink(new_dir, new_dentry); | 1805 | (void) shmem_unlink(new_dir, new_dentry); |
1806 | if (they_are_dirs) | 1806 | if (they_are_dirs) |
1807 | old_dir->i_nlink--; | 1807 | drop_nlink(old_dir); |
1808 | } else if (they_are_dirs) { | 1808 | } else if (they_are_dirs) { |
1809 | old_dir->i_nlink--; | 1809 | drop_nlink(old_dir); |
1810 | new_dir->i_nlink++; | 1810 | new_dir->i_nlink++; |
1811 | } | 1811 | } |
1812 | 1812 | ||