aboutsummaryrefslogtreecommitdiffstats
path: root/fs/reiserfs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/reiserfs/inode.c')
-rw-r--r--fs/reiserfs/inode.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index 290ae38fca8a..2df0f5c7c60b 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -31,11 +31,12 @@ void reiserfs_delete_inode(struct inode *inode)
31 JOURNAL_PER_BALANCE_CNT * 2 + 31 JOURNAL_PER_BALANCE_CNT * 2 +
32 2 * REISERFS_QUOTA_INIT_BLOCKS(inode->i_sb); 32 2 * REISERFS_QUOTA_INIT_BLOCKS(inode->i_sb);
33 struct reiserfs_transaction_handle th; 33 struct reiserfs_transaction_handle th;
34 int depth;
34 int err; 35 int err;
35 36
36 truncate_inode_pages(&inode->i_data, 0); 37 truncate_inode_pages(&inode->i_data, 0);
37 38
38 reiserfs_write_lock(inode->i_sb); 39 depth = reiserfs_write_lock_once(inode->i_sb);
39 40
40 /* The = 0 happens when we abort creating a new inode for some reason like lack of space.. */ 41 /* The = 0 happens when we abort creating a new inode for some reason like lack of space.. */
41 if (!(inode->i_state & I_NEW) && INODE_PKEY(inode)->k_objectid != 0) { /* also handles bad_inode case */ 42 if (!(inode->i_state & I_NEW) && INODE_PKEY(inode)->k_objectid != 0) { /* also handles bad_inode case */
@@ -74,7 +75,7 @@ void reiserfs_delete_inode(struct inode *inode)
74 out: 75 out:
75 clear_inode(inode); /* note this must go after the journal_end to prevent deadlock */ 76 clear_inode(inode); /* note this must go after the journal_end to prevent deadlock */
76 inode->i_blocks = 0; 77 inode->i_blocks = 0;
77 reiserfs_write_unlock(inode->i_sb); 78 reiserfs_write_unlock_once(inode->i_sb, depth);
78} 79}
79 80
80static void _make_cpu_key(struct cpu_key *key, int version, __u32 dirid, 81static void _make_cpu_key(struct cpu_key *key, int version, __u32 dirid,
@@ -1496,9 +1497,11 @@ struct inode *reiserfs_iget(struct super_block *s, const struct cpu_key *key)
1496 1497
1497 args.objectid = key->on_disk_key.k_objectid; 1498 args.objectid = key->on_disk_key.k_objectid;
1498 args.dirid = key->on_disk_key.k_dir_id; 1499 args.dirid = key->on_disk_key.k_dir_id;
1500 reiserfs_write_unlock(s);
1499 inode = iget5_locked(s, key->on_disk_key.k_objectid, 1501 inode = iget5_locked(s, key->on_disk_key.k_objectid,
1500 reiserfs_find_actor, reiserfs_init_locked_inode, 1502 reiserfs_find_actor, reiserfs_init_locked_inode,
1501 (void *)(&args)); 1503 (void *)(&args));
1504 reiserfs_write_lock(s);
1502 if (!inode) 1505 if (!inode)
1503 return ERR_PTR(-ENOMEM); 1506 return ERR_PTR(-ENOMEM);
1504 1507
@@ -3061,13 +3064,14 @@ static ssize_t reiserfs_direct_IO(int rw, struct kiocb *iocb,
3061int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) 3064int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
3062{ 3065{
3063 struct inode *inode = dentry->d_inode; 3066 struct inode *inode = dentry->d_inode;
3064 int error;
3065 unsigned int ia_valid; 3067 unsigned int ia_valid;
3068 int depth;
3069 int error;
3066 3070
3067 /* must be turned off for recursive notify_change calls */ 3071 /* must be turned off for recursive notify_change calls */
3068 ia_valid = attr->ia_valid &= ~(ATTR_KILL_SUID|ATTR_KILL_SGID); 3072 ia_valid = attr->ia_valid &= ~(ATTR_KILL_SUID|ATTR_KILL_SGID);
3069 3073
3070 reiserfs_write_lock(inode->i_sb); 3074 depth = reiserfs_write_lock_once(inode->i_sb);
3071 if (attr->ia_valid & ATTR_SIZE) { 3075 if (attr->ia_valid & ATTR_SIZE) {
3072 /* version 2 items will be caught by the s_maxbytes check 3076 /* version 2 items will be caught by the s_maxbytes check
3073 ** done for us in vmtruncate 3077 ** done for us in vmtruncate
@@ -3148,8 +3152,17 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
3148 journal_end(&th, inode->i_sb, jbegin_count); 3152 journal_end(&th, inode->i_sb, jbegin_count);
3149 } 3153 }
3150 } 3154 }
3151 if (!error) 3155 if (!error) {
3156 /*
3157 * Relax the lock here, as it might truncate the
3158 * inode pages and wait for inode pages locks.
3159 * To release such page lock, the owner needs the
3160 * reiserfs lock
3161 */
3162 reiserfs_write_unlock_once(inode->i_sb, depth);
3152 error = inode_setattr(inode, attr); 3163 error = inode_setattr(inode, attr);
3164 depth = reiserfs_write_lock_once(inode->i_sb);
3165 }
3153 } 3166 }
3154 3167
3155 if (!error && reiserfs_posixacl(inode->i_sb)) { 3168 if (!error && reiserfs_posixacl(inode->i_sb)) {
@@ -3158,7 +3171,8 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
3158 } 3171 }
3159 3172
3160 out: 3173 out:
3161 reiserfs_write_unlock(inode->i_sb); 3174 reiserfs_write_unlock_once(inode->i_sb, depth);
3175
3162 return error; 3176 return error;
3163} 3177}
3164 3178