diff options
Diffstat (limited to 'fs/reiserfs/xattr.c')
-rw-r--r-- | fs/reiserfs/xattr.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c index c3b004ee627b..81f09fab8ae4 100644 --- a/fs/reiserfs/xattr.c +++ b/fs/reiserfs/xattr.c | |||
@@ -452,7 +452,9 @@ static int lookup_and_delete_xattr(struct inode *inode, const char *name) | |||
452 | } | 452 | } |
453 | 453 | ||
454 | if (dentry->d_inode) { | 454 | if (dentry->d_inode) { |
455 | reiserfs_write_lock(inode->i_sb); | ||
455 | err = xattr_unlink(xadir->d_inode, dentry); | 456 | err = xattr_unlink(xadir->d_inode, dentry); |
457 | reiserfs_write_unlock(inode->i_sb); | ||
456 | update_ctime(inode); | 458 | update_ctime(inode); |
457 | } | 459 | } |
458 | 460 | ||
@@ -486,17 +488,21 @@ reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *th, | |||
486 | if (get_inode_sd_version(inode) == STAT_DATA_V1) | 488 | if (get_inode_sd_version(inode) == STAT_DATA_V1) |
487 | return -EOPNOTSUPP; | 489 | return -EOPNOTSUPP; |
488 | 490 | ||
489 | if (!buffer) | ||
490 | return lookup_and_delete_xattr(inode, name); | ||
491 | |||
492 | reiserfs_write_unlock(inode->i_sb); | 491 | reiserfs_write_unlock(inode->i_sb); |
492 | |||
493 | if (!buffer) { | ||
494 | err = lookup_and_delete_xattr(inode, name); | ||
495 | reiserfs_write_lock(inode->i_sb); | ||
496 | return err; | ||
497 | } | ||
498 | |||
493 | dentry = xattr_lookup(inode, name, flags); | 499 | dentry = xattr_lookup(inode, name, flags); |
494 | if (IS_ERR(dentry)) { | 500 | if (IS_ERR(dentry)) { |
495 | reiserfs_write_lock(inode->i_sb); | 501 | reiserfs_write_lock(inode->i_sb); |
496 | return PTR_ERR(dentry); | 502 | return PTR_ERR(dentry); |
497 | } | 503 | } |
498 | 504 | ||
499 | down_read(&REISERFS_I(inode)->i_xattr_sem); | 505 | down_write(&REISERFS_I(inode)->i_xattr_sem); |
500 | 506 | ||
501 | reiserfs_write_lock(inode->i_sb); | 507 | reiserfs_write_lock(inode->i_sb); |
502 | 508 | ||
@@ -554,8 +560,12 @@ reiserfs_xattr_set_handle(struct reiserfs_transaction_handle *th, | |||
554 | .ia_size = buffer_size, | 560 | .ia_size = buffer_size, |
555 | .ia_valid = ATTR_SIZE | ATTR_CTIME, | 561 | .ia_valid = ATTR_SIZE | ATTR_CTIME, |
556 | }; | 562 | }; |
563 | |||
564 | reiserfs_write_unlock(inode->i_sb); | ||
557 | mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_XATTR); | 565 | mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_XATTR); |
558 | down_write(&dentry->d_inode->i_alloc_sem); | 566 | down_write(&dentry->d_inode->i_alloc_sem); |
567 | reiserfs_write_lock(inode->i_sb); | ||
568 | |||
559 | err = reiserfs_setattr(dentry, &newattrs); | 569 | err = reiserfs_setattr(dentry, &newattrs); |
560 | up_write(&dentry->d_inode->i_alloc_sem); | 570 | up_write(&dentry->d_inode->i_alloc_sem); |
561 | mutex_unlock(&dentry->d_inode->i_mutex); | 571 | mutex_unlock(&dentry->d_inode->i_mutex); |