Commit 82062e7b authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'reiserfs/kill-bkl' of...

Merge branch 'reiserfs/kill-bkl' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing

* 'reiserfs/kill-bkl' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic/random-tracing:
  reiserfs: Relax reiserfs_xattr_set_handle() while acquiring xattr locks
  reiserfs: Fix unreachable statement
  reiserfs: Don't call reiserfs_get_acl() with the reiserfs lock
  reiserfs: Relax lock on xattr removing
  reiserfs: Relax the lock before truncating pages
  reiserfs: Fix recursive lock on lchown
  reiserfs: Fix mistake in down_write() conversion
parents dbd6a7cf 31370f62
...@@ -3062,13 +3062,14 @@ static ssize_t reiserfs_direct_IO(int rw, struct kiocb *iocb, ...@@ -3062,13 +3062,14 @@ static ssize_t reiserfs_direct_IO(int rw, struct kiocb *iocb,
int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
{ {
struct inode *inode = dentry->d_inode; struct inode *inode = dentry->d_inode;
int error;
unsigned int ia_valid; unsigned int ia_valid;
int depth;
int error;
/* must be turned off for recursive notify_change calls */ /* must be turned off for recursive notify_change calls */
ia_valid = attr->ia_valid &= ~(ATTR_KILL_SUID|ATTR_KILL_SGID); ia_valid = attr->ia_valid &= ~(ATTR_KILL_SUID|ATTR_KILL_SGID);
reiserfs_write_lock(inode->i_sb); depth = reiserfs_write_lock_once(inode->i_sb);
if (attr->ia_valid & ATTR_SIZE) { if (attr->ia_valid & ATTR_SIZE) {
/* version 2 items will be caught by the s_maxbytes check /* version 2 items will be caught by the s_maxbytes check
** done for us in vmtruncate ** done for us in vmtruncate
...@@ -3149,8 +3150,17 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) ...@@ -3149,8 +3150,17 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
journal_end(&th, inode->i_sb, jbegin_count); journal_end(&th, inode->i_sb, jbegin_count);
} }
} }
if (!error) if (!error) {
/*
* Relax the lock here, as it might truncate the
* inode pages and wait for inode pages locks.
* To release such page lock, the owner needs the
* reiserfs lock
*/
reiserfs_write_unlock_once(inode->i_sb, depth);
error = inode_setattr(inode, attr); error = inode_setattr(inode, attr);
depth = reiserfs_write_lock_once(inode->i_sb);
}
} }
if (!error && reiserfs_posixacl(inode->i_sb)) { if (!error && reiserfs_posixacl(inode->i_sb)) {
...@@ -3159,7 +3169,8 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) ...@@ -3159,7 +3169,8 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
} }
out: out:
reiserfs_write_unlock(inode->i_sb); reiserfs_write_unlock_once(inode->i_sb, depth);
return error; return error;
} }
......
...@@ -104,9 +104,10 @@ setflags_out: ...@@ -104,9 +104,10 @@ setflags_out:
err = put_user(inode->i_generation, (int __user *)arg); err = put_user(inode->i_generation, (int __user *)arg);
break; break;
case REISERFS_IOC_SETVERSION: case REISERFS_IOC_SETVERSION:
if (!is_owner_or_cap(inode)) if (!is_owner_or_cap(inode)) {
err = -EPERM; err = -EPERM;
break; break;
}
err = mnt_want_write(filp->f_path.mnt); err = mnt_want_write(filp->f_path.mnt);
if (err) if (err)
break; break;
......
...@@ -452,7 +452,9 @@ static int lookup_and_delete_xattr(struct inode *inode, const char *name) ...@@ -452,7 +452,9 @@ static int lookup_and_delete_xattr(struct inode *inode, const char *name)
} }
if (dentry->d_inode) { if (dentry->d_inode) {
reiserfs_write_lock(inode->i_sb);
err = xattr_unlink(xadir->d_inode, dentry); err = xattr_unlink(xadir->d_inode, dentry);
reiserfs_write_unlock(inode->i_sb);
update_ctime(inode); update_ctime(inode);
} }
...@@ -486,17 +488,21 @@ reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *th, ...@@ -486,17 +488,21 @@ reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *th,
if (get_inode_sd_version(inode) == STAT_DATA_V1) if (get_inode_sd_version(inode) == STAT_DATA_V1)
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (!buffer)
return lookup_and_delete_xattr(inode, name);
reiserfs_write_unlock(inode->i_sb); reiserfs_write_unlock(inode->i_sb);
if (!buffer) {
err = lookup_and_delete_xattr(inode, name);
reiserfs_write_lock(inode->i_sb);
return err;
}
dentry = xattr_lookup(inode, name, flags); dentry = xattr_lookup(inode, name, flags);
if (IS_ERR(dentry)) { if (IS_ERR(dentry)) {
reiserfs_write_lock(inode->i_sb); reiserfs_write_lock(inode->i_sb);
return PTR_ERR(dentry); return PTR_ERR(dentry);
} }
down_read(&REISERFS_I(inode)->i_xattr_sem); down_write(&REISERFS_I(inode)->i_xattr_sem);
reiserfs_write_lock(inode->i_sb); reiserfs_write_lock(inode->i_sb);
...@@ -554,8 +560,12 @@ reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *th, ...@@ -554,8 +560,12 @@ reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *th,
.ia_size = buffer_size, .ia_size = buffer_size,
.ia_valid = ATTR_SIZE | ATTR_CTIME, .ia_valid = ATTR_SIZE | ATTR_CTIME,
}; };
reiserfs_write_unlock(inode->i_sb);
mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_XATTR); mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_XATTR);
down_write(&dentry->d_inode->i_alloc_sem); down_write(&dentry->d_inode->i_alloc_sem);
reiserfs_write_lock(inode->i_sb);
err = reiserfs_setattr(dentry, &newattrs); err = reiserfs_setattr(dentry, &newattrs);
up_write(&dentry->d_inode->i_alloc_sem); up_write(&dentry->d_inode->i_alloc_sem);
mutex_unlock(&dentry->d_inode->i_mutex); mutex_unlock(&dentry->d_inode->i_mutex);
......
...@@ -455,7 +455,9 @@ int reiserfs_acl_chmod(struct inode *inode) ...@@ -455,7 +455,9 @@ int reiserfs_acl_chmod(struct inode *inode)
return 0; return 0;
} }
reiserfs_write_unlock(inode->i_sb);
acl = reiserfs_get_acl(inode, ACL_TYPE_ACCESS); acl = reiserfs_get_acl(inode, ACL_TYPE_ACCESS);
reiserfs_write_lock(inode->i_sb);
if (!acl) if (!acl)
return 0; return 0;
if (IS_ERR(acl)) if (IS_ERR(acl))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment