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
This commit is contained in:
commit
82062e7b50
4 changed files with 33 additions and 9 deletions
|
@ -3062,13 +3062,14 @@ static ssize_t reiserfs_direct_IO(int rw, struct kiocb *iocb,
|
|||
int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
|
||||
{
|
||||
struct inode *inode = dentry->d_inode;
|
||||
int error;
|
||||
unsigned int ia_valid;
|
||||
int depth;
|
||||
int error;
|
||||
|
||||
/* must be turned off for recursive notify_change calls */
|
||||
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) {
|
||||
/* version 2 items will be caught by the s_maxbytes check
|
||||
** done for us in vmtruncate
|
||||
|
@ -3149,8 +3150,17 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
|
|||
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);
|
||||
depth = reiserfs_write_lock_once(inode->i_sb);
|
||||
}
|
||||
}
|
||||
|
||||
if (!error && reiserfs_posixacl(inode->i_sb)) {
|
||||
|
@ -3159,7 +3169,8 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr)
|
|||
}
|
||||
|
||||
out:
|
||||
reiserfs_write_unlock(inode->i_sb);
|
||||
reiserfs_write_unlock_once(inode->i_sb, depth);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
|
|
|
@ -104,9 +104,10 @@ long reiserfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
|||
err = put_user(inode->i_generation, (int __user *)arg);
|
||||
break;
|
||||
case REISERFS_IOC_SETVERSION:
|
||||
if (!is_owner_or_cap(inode))
|
||||
if (!is_owner_or_cap(inode)) {
|
||||
err = -EPERM;
|
||||
break;
|
||||
}
|
||||
err = mnt_want_write(filp->f_path.mnt);
|
||||
if (err)
|
||||
break;
|
||||
|
|
|
@ -452,7 +452,9 @@ static int lookup_and_delete_xattr(struct inode *inode, const char *name)
|
|||
}
|
||||
|
||||
if (dentry->d_inode) {
|
||||
reiserfs_write_lock(inode->i_sb);
|
||||
err = xattr_unlink(xadir->d_inode, dentry);
|
||||
reiserfs_write_unlock(inode->i_sb);
|
||||
update_ctime(inode);
|
||||
}
|
||||
|
||||
|
@ -486,17 +488,21 @@ reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *th,
|
|||
if (get_inode_sd_version(inode) == STAT_DATA_V1)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
if (!buffer)
|
||||
return lookup_and_delete_xattr(inode, name);
|
||||
|
||||
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);
|
||||
if (IS_ERR(dentry)) {
|
||||
reiserfs_write_lock(inode->i_sb);
|
||||
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);
|
||||
|
||||
|
@ -554,8 +560,12 @@ reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *th,
|
|||
.ia_size = buffer_size,
|
||||
.ia_valid = ATTR_SIZE | ATTR_CTIME,
|
||||
};
|
||||
|
||||
reiserfs_write_unlock(inode->i_sb);
|
||||
mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_XATTR);
|
||||
down_write(&dentry->d_inode->i_alloc_sem);
|
||||
reiserfs_write_lock(inode->i_sb);
|
||||
|
||||
err = reiserfs_setattr(dentry, &newattrs);
|
||||
up_write(&dentry->d_inode->i_alloc_sem);
|
||||
mutex_unlock(&dentry->d_inode->i_mutex);
|
||||
|
|
|
@ -455,7 +455,9 @@ int reiserfs_acl_chmod(struct inode *inode)
|
|||
return 0;
|
||||
}
|
||||
|
||||
reiserfs_write_unlock(inode->i_sb);
|
||||
acl = reiserfs_get_acl(inode, ACL_TYPE_ACCESS);
|
||||
reiserfs_write_lock(inode->i_sb);
|
||||
if (!acl)
|
||||
return 0;
|
||||
if (IS_ERR(acl))
|
||||
|
|
Loading…
Reference in a new issue