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 /fs/cifs | |
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 'fs/cifs')
-rw-r--r-- | fs/cifs/inode.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 05f874c7441b..74441a17e186 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -590,7 +590,7 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry) | |||
590 | 590 | ||
591 | if (!rc) { | 591 | if (!rc) { |
592 | if (direntry->d_inode) | 592 | if (direntry->d_inode) |
593 | direntry->d_inode->i_nlink--; | 593 | drop_nlink(direntry->d_inode); |
594 | } else if (rc == -ENOENT) { | 594 | } else if (rc == -ENOENT) { |
595 | d_drop(direntry); | 595 | d_drop(direntry); |
596 | } else if (rc == -ETXTBSY) { | 596 | } else if (rc == -ETXTBSY) { |
@@ -609,7 +609,7 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry) | |||
609 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 609 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
610 | CIFSSMBClose(xid, pTcon, netfid); | 610 | CIFSSMBClose(xid, pTcon, netfid); |
611 | if (direntry->d_inode) | 611 | if (direntry->d_inode) |
612 | direntry->d_inode->i_nlink--; | 612 | drop_nlink(direntry->d_inode); |
613 | } | 613 | } |
614 | } else if (rc == -EACCES) { | 614 | } else if (rc == -EACCES) { |
615 | /* try only if r/o attribute set in local lookup data? */ | 615 | /* try only if r/o attribute set in local lookup data? */ |
@@ -663,7 +663,7 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry) | |||
663 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 663 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
664 | if (!rc) { | 664 | if (!rc) { |
665 | if (direntry->d_inode) | 665 | if (direntry->d_inode) |
666 | direntry->d_inode->i_nlink--; | 666 | drop_nlink(direntry->d_inode); |
667 | } else if (rc == -ETXTBSY) { | 667 | } else if (rc == -ETXTBSY) { |
668 | int oplock = FALSE; | 668 | int oplock = FALSE; |
669 | __u16 netfid; | 669 | __u16 netfid; |
@@ -684,7 +684,7 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry) | |||
684 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 684 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
685 | CIFSSMBClose(xid, pTcon, netfid); | 685 | CIFSSMBClose(xid, pTcon, netfid); |
686 | if (direntry->d_inode) | 686 | if (direntry->d_inode) |
687 | direntry->d_inode->i_nlink--; | 687 | drop_nlink(direntry->d_inode); |
688 | } | 688 | } |
689 | /* BB if rc = -ETXTBUSY goto the rename logic BB */ | 689 | /* BB if rc = -ETXTBUSY goto the rename logic BB */ |
690 | } | 690 | } |
@@ -816,7 +816,7 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry) | |||
816 | cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); | 816 | cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); |
817 | 817 | ||
818 | if (!rc) { | 818 | if (!rc) { |
819 | inode->i_nlink--; | 819 | drop_nlink(inode); |
820 | i_size_write(direntry->d_inode,0); | 820 | i_size_write(direntry->d_inode,0); |
821 | direntry->d_inode->i_nlink = 0; | 821 | direntry->d_inode->i_nlink = 0; |
822 | } | 822 | } |