aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorDave Hansen <haveblue@us.ibm.com>2006-09-30 23:29:06 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-01 00:39:30 -0700
commitce71ec36840368b877fb63bd14c8e67ab62d08b1 (patch)
tree55ea3caaa339881dfd66d787b3dbbb964825d07a /fs
parent17ff785691503f63ec648df82a7fdaece7695561 (diff)
downloadkernel_samsung_tuna-ce71ec36840368b877fb63bd14c8e67ab62d08b1.zip
kernel_samsung_tuna-ce71ec36840368b877fb63bd14c8e67ab62d08b1.tar.gz
kernel_samsung_tuna-ce71ec36840368b877fb63bd14c8e67ab62d08b1.tar.bz2
[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>
Diffstat (limited to 'fs')
-rw-r--r--fs/autofs4/root.c4
-rw-r--r--fs/cifs/inode.c2
-rw-r--r--fs/ext3/namei.c2
-rw-r--r--fs/fuse/dir.c4
-rw-r--r--fs/hfs/dir.c2
-rw-r--r--fs/hfsplus/dir.c4
-rw-r--r--fs/hpfs/namei.c4
-rw-r--r--fs/jfs/namei.c2
-rw-r--r--fs/msdos/namei.c4
-rw-r--r--fs/nfs/dir.c2
-rw-r--r--fs/qnx4/namei.c2
-rw-r--r--fs/reiserfs/namei.c4
-rw-r--r--fs/udf/namei.c2
-rw-r--r--fs/vfat/namei.c4
14 files changed, 21 insertions, 21 deletions
diff --git a/fs/autofs4/root.c b/fs/autofs4/root.c
index e21bb46..c149352 100644
--- a/fs/autofs4/root.c
+++ b/fs/autofs4/root.c
@@ -638,7 +638,7 @@ static int autofs4_dir_unlink(struct inode *dir, struct dentry *dentry)
dput(ino->dentry);
dentry->d_inode->i_size = 0;
- dentry->d_inode->i_nlink = 0;
+ clear_nlink(dentry->d_inode);
dir->i_mtime = CURRENT_TIME;
@@ -673,7 +673,7 @@ static int autofs4_dir_rmdir(struct inode *dir, struct dentry *dentry)
}
dput(ino->dentry);
dentry->d_inode->i_size = 0;
- dentry->d_inode->i_nlink = 0;
+ clear_nlink(dentry->d_inode);
if (dir->i_nlink)
drop_nlink(dir);
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 76b7fb3..6b90ef9 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -818,7 +818,7 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry)
if (!rc) {
drop_nlink(inode);
i_size_write(direntry->d_inode,0);
- direntry->d_inode->i_nlink = 0;
+ clear_nlink(direntry->d_inode);
}
cifsInode = CIFS_I(direntry->d_inode);
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
index b45c88b..906731a 100644
--- a/fs/ext3/namei.c
+++ b/fs/ext3/namei.c
@@ -2045,7 +2045,7 @@ static int ext3_rmdir (struct inode * dir, struct dentry *dentry)
"empty directory has nlink!=2 (%d)",
inode->i_nlink);
inode->i_version++;
- inode->i_nlink = 0;
+ clear_nlink(inode);
/* There's no need to set i_disksize: the fact that i_nlink is
* zero will ensure that the right thing happens during any
* recovery. */
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index f85b2a2..8605155 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -508,7 +508,7 @@ static int fuse_unlink(struct inode *dir, struct dentry *entry)
/* Set nlink to zero so the inode can be cleared, if
the inode does have more links this will be
discovered at the next lookup/getattr */
- inode->i_nlink = 0;
+ clear_nlink(inode);
fuse_invalidate_attr(inode);
fuse_invalidate_attr(dir);
fuse_invalidate_entry_cache(entry);
@@ -534,7 +534,7 @@ static int fuse_rmdir(struct inode *dir, struct dentry *entry)
err = req->out.h.error;
fuse_put_request(fc, req);
if (!err) {
- entry->d_inode->i_nlink = 0;
+ clear_nlink(entry->d_inode);
fuse_invalidate_attr(dir);
fuse_invalidate_entry_cache(entry);
} else if (err == -EINTR)
diff --git a/fs/hfs/dir.c b/fs/hfs/dir.c
index cfef6ad..37d681b 100644
--- a/fs/hfs/dir.c
+++ b/fs/hfs/dir.c
@@ -273,7 +273,7 @@ static int hfs_rmdir(struct inode *dir, struct dentry *dentry)
res = hfs_cat_delete(inode->i_ino, dir, &dentry->d_name);
if (res)
return res;
- inode->i_nlink = 0;
+ clear_nlink(inode);
inode->i_ctime = CURRENT_TIME_SEC;
hfs_delete_inode(inode);
mark_inode_dirty(inode);
diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c
index 99b4ed1..7e30975 100644
--- a/fs/hfsplus/dir.c
+++ b/fs/hfsplus/dir.c
@@ -348,7 +348,7 @@ static int hfsplus_unlink(struct inode *dir, struct dentry *dentry)
} else
inode->i_flags |= S_DEAD;
} else
- inode->i_nlink = 0;
+ clear_nlink(inode);
inode->i_ctime = CURRENT_TIME_SEC;
mark_inode_dirty(inode);
@@ -387,7 +387,7 @@ static int hfsplus_rmdir(struct inode *dir, struct dentry *dentry)
res = hfsplus_delete_cat(inode->i_ino, dir, &dentry->d_name);
if (res)
return res;
- inode->i_nlink = 0;
+ clear_nlink(inode);
inode->i_ctime = CURRENT_TIME_SEC;
hfsplus_delete_inode(inode);
mark_inode_dirty(inode);
diff --git a/fs/hpfs/namei.c b/fs/hpfs/namei.c
index 25dd6f8..2507e73 100644
--- a/fs/hpfs/namei.c
+++ b/fs/hpfs/namei.c
@@ -495,7 +495,7 @@ static int hpfs_rmdir(struct inode *dir, struct dentry *dentry)
break;
default:
drop_nlink(dir);
- inode->i_nlink = 0;
+ clear_nlink(inode);
err = 0;
}
goto out;
@@ -590,7 +590,7 @@ static int hpfs_rename(struct inode *old_dir, struct dentry *old_dentry,
int r;
if ((r = hpfs_remove_dirent(old_dir, dno, dep, &qbh, 1)) != 2) {
if ((nde = map_dirent(new_dir, hpfs_i(new_dir)->i_dno, (char *)new_name, new_len, NULL, &qbh1))) {
- new_inode->i_nlink = 0;
+ clear_nlink(new_inode);
copy_de(nde, &de);
memcpy(nde->name, new_name, new_len);
hpfs_mark_4buffers_dirty(&qbh1);
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c
index 8cef881..b8d16a6 100644
--- a/fs/jfs/namei.c
+++ b/fs/jfs/namei.c
@@ -414,7 +414,7 @@ static int jfs_rmdir(struct inode *dip, struct dentry *dentry)
JFS_IP(ip)->acl.flag = 0;
/* mark the target directory as deleted */
- ip->i_nlink = 0;
+ clear_nlink(ip);
mark_inode_dirty(ip);
rc = txCommit(tid, 2, &iplist[0], 0);
diff --git a/fs/msdos/namei.c b/fs/msdos/namei.c
index fa868c7..b0f01b3 100644
--- a/fs/msdos/namei.c
+++ b/fs/msdos/namei.c
@@ -345,7 +345,7 @@ static int msdos_rmdir(struct inode *dir, struct dentry *dentry)
goto out;
drop_nlink(dir);
- inode->i_nlink = 0;
+ clear_nlink(inode);
inode->i_ctime = CURRENT_TIME_SEC;
fat_detach(inode);
out:
@@ -430,7 +430,7 @@ static int msdos_unlink(struct inode *dir, struct dentry *dentry)
err = fat_remove_entries(dir, &sinfo); /* and releases bh */
if (err)
goto out;
- inode->i_nlink = 0;
+ clear_nlink(inode);
inode->i_ctime = CURRENT_TIME_SEC;
fat_detach(inode);
out:
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 26eecb8..481f889 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -1286,7 +1286,7 @@ static int nfs_rmdir(struct inode *dir, struct dentry *dentry)
error = NFS_PROTO(dir)->rmdir(dir, &dentry->d_name);
/* Ensure the VFS deletes this inode */
if (error == 0 && dentry->d_inode != NULL)
- dentry->d_inode->i_nlink = 0;
+ clear_nlink(dentry->d_inode);
nfs_end_data_update(dir);
unlock_kernel();
diff --git a/fs/qnx4/namei.c b/fs/qnx4/namei.c
index ad5afa4..733cdf0 100644
--- a/fs/qnx4/namei.c
+++ b/fs/qnx4/namei.c
@@ -186,7 +186,7 @@ int qnx4_rmdir(struct inode *dir, struct dentry *dentry)
memset(de->di_fname, 0, sizeof de->di_fname);
de->di_mode = 0;
mark_buffer_dirty(bh);
- inode->i_nlink = 0;
+ clear_nlink(inode);
mark_inode_dirty(inode);
inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
inode_dec_link_count(dir);
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c
index cf92e89..16e9cff 100644
--- a/fs/reiserfs/namei.c
+++ b/fs/reiserfs/namei.c
@@ -913,7 +913,7 @@ static int reiserfs_rmdir(struct inode *dir, struct dentry *dentry)
reiserfs_warning(inode->i_sb, "%s: empty directory has nlink "
"!= 2 (%d)", __FUNCTION__, inode->i_nlink);
- inode->i_nlink = 0;
+ clear_nlink(inode);
inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME_SEC;
reiserfs_update_sd(&th, inode);
@@ -1473,7 +1473,7 @@ static int reiserfs_rename(struct inode *old_dir, struct dentry *old_dentry,
if (new_dentry_inode) {
// adjust link number of the victim
if (S_ISDIR(new_dentry_inode->i_mode)) {
- new_dentry_inode->i_nlink = 0;
+ clear_nlink(new_dentry_inode);
} else {
drop_nlink(new_dentry_inode);
}
diff --git a/fs/udf/namei.c b/fs/udf/namei.c
index e40c95e..7316332 100644
--- a/fs/udf/namei.c
+++ b/fs/udf/namei.c
@@ -876,7 +876,7 @@ static int udf_rmdir(struct inode * dir, struct dentry * dentry)
udf_warning(inode->i_sb, "udf_rmdir",
"empty directory has nlink != 2 (%d)",
inode->i_nlink);
- inode->i_nlink = 0;
+ clear_nlink(inode);
inode->i_size = 0;
inode_dec_link_count(inode);
inode->i_ctime = dir->i_ctime = dir->i_mtime = current_fs_time(dir->i_sb);
diff --git a/fs/vfat/namei.c b/fs/vfat/namei.c
index 5846ba2..edb711f 100644
--- a/fs/vfat/namei.c
+++ b/fs/vfat/namei.c
@@ -784,7 +784,7 @@ static int vfat_rmdir(struct inode *dir, struct dentry *dentry)
goto out;
drop_nlink(dir);
- inode->i_nlink = 0;
+ clear_nlink(inode);
inode->i_mtime = inode->i_atime = CURRENT_TIME_SEC;
fat_detach(inode);
out:
@@ -808,7 +808,7 @@ static int vfat_unlink(struct inode *dir, struct dentry *dentry)
err = fat_remove_entries(dir, &sinfo); /* and releases bh */
if (err)
goto out;
- inode->i_nlink = 0;
+ clear_nlink(inode);
inode->i_mtime = inode->i_atime = CURRENT_TIME_SEC;
fat_detach(inode);
out: