diff options
Diffstat (limited to 'fs/reiserfs')
-rw-r--r-- | fs/reiserfs/inode.c | 21 | ||||
-rw-r--r-- | fs/reiserfs/ioctl.c | 3 | ||||
-rw-r--r-- | fs/reiserfs/journal.c | 2 | ||||
-rw-r--r-- | fs/reiserfs/xattr.c | 18 | ||||
-rw-r--r-- | fs/reiserfs/xattr_acl.c | 2 |
5 files changed, 37 insertions, 9 deletions
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index 1150ebb2536f..2df0f5c7c60b 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c | |||
@@ -1497,9 +1497,11 @@ struct inode *reiserfs_iget(struct super_block *s, const struct cpu_key *key) | |||
1497 | 1497 | ||
1498 | args.objectid = key->on_disk_key.k_objectid; | 1498 | args.objectid = key->on_disk_key.k_objectid; |
1499 | args.dirid = key->on_disk_key.k_dir_id; | 1499 | args.dirid = key->on_disk_key.k_dir_id; |
1500 | reiserfs_write_unlock(s); | ||
1500 | inode = iget5_locked(s, key->on_disk_key.k_objectid, | 1501 | inode = iget5_locked(s, key->on_disk_key.k_objectid, |
1501 | reiserfs_find_actor, reiserfs_init_locked_inode, | 1502 | reiserfs_find_actor, reiserfs_init_locked_inode, |
1502 | (void *)(&args)); | 1503 | (void *)(&args)); |
1504 | reiserfs_write_lock(s); | ||
1503 | if (!inode) | 1505 | if (!inode) |
1504 | return ERR_PTR(-ENOMEM); | 1506 | return ERR_PTR(-ENOMEM); |
1505 | 1507 | ||
@@ -3062,13 +3064,14 @@ static ssize_t reiserfs_direct_IO(int rw, struct kiocb *iocb, | |||
3062 | int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) | 3064 | int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) |
3063 | { | 3065 | { |
3064 | struct inode *inode = dentry->d_inode; | 3066 | struct inode *inode = dentry->d_inode; |
3065 | int error; | ||
3066 | unsigned int ia_valid; | 3067 | unsigned int ia_valid; |
3068 | int depth; | ||
3069 | int error; | ||
3067 | 3070 | ||
3068 | /* must be turned off for recursive notify_change calls */ | 3071 | /* must be turned off for recursive notify_change calls */ |
3069 | ia_valid = attr->ia_valid &= ~(ATTR_KILL_SUID|ATTR_KILL_SGID); | 3072 | ia_valid = attr->ia_valid &= ~(ATTR_KILL_SUID|ATTR_KILL_SGID); |
3070 | 3073 | ||
3071 | reiserfs_write_lock(inode->i_sb); | 3074 | depth = reiserfs_write_lock_once(inode->i_sb); |
3072 | if (attr->ia_valid & ATTR_SIZE) { | 3075 | if (attr->ia_valid & ATTR_SIZE) { |
3073 | /* version 2 items will be caught by the s_maxbytes check | 3076 | /* version 2 items will be caught by the s_maxbytes check |
3074 | ** done for us in vmtruncate | 3077 | ** done for us in vmtruncate |
@@ -3149,8 +3152,17 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) | |||
3149 | journal_end(&th, inode->i_sb, jbegin_count); | 3152 | journal_end(&th, inode->i_sb, jbegin_count); |
3150 | } | 3153 | } |
3151 | } | 3154 | } |
3152 | 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); | ||
3153 | error = inode_setattr(inode, attr); | 3163 | error = inode_setattr(inode, attr); |
3164 | depth = reiserfs_write_lock_once(inode->i_sb); | ||
3165 | } | ||
3154 | } | 3166 | } |
3155 | 3167 | ||
3156 | if (!error && reiserfs_posixacl(inode->i_sb)) { | 3168 | if (!error && reiserfs_posixacl(inode->i_sb)) { |
@@ -3159,7 +3171,8 @@ int reiserfs_setattr(struct dentry *dentry, struct iattr *attr) | |||
3159 | } | 3171 | } |
3160 | 3172 | ||
3161 | out: | 3173 | out: |
3162 | reiserfs_write_unlock(inode->i_sb); | 3174 | reiserfs_write_unlock_once(inode->i_sb, depth); |
3175 | |||
3163 | return error; | 3176 | return error; |
3164 | } | 3177 | } |
3165 | 3178 | ||
diff --git a/fs/reiserfs/ioctl.c b/fs/reiserfs/ioctl.c index ace77451ceb1..f53505de0712 100644 --- a/fs/reiserfs/ioctl.c +++ b/fs/reiserfs/ioctl.c | |||
@@ -104,9 +104,10 @@ setflags_out: | |||
104 | err = put_user(inode->i_generation, (int __user *)arg); | 104 | err = put_user(inode->i_generation, (int __user *)arg); |
105 | break; | 105 | break; |
106 | case REISERFS_IOC_SETVERSION: | 106 | case REISERFS_IOC_SETVERSION: |
107 | if (!is_owner_or_cap(inode)) | 107 | if (!is_owner_or_cap(inode)) { |
108 | err = -EPERM; | 108 | err = -EPERM; |
109 | break; | 109 | break; |
110 | } | ||
110 | err = mnt_want_write(filp->f_path.mnt); | 111 | err = mnt_want_write(filp->f_path.mnt); |
111 | if (err) | 112 | if (err) |
112 | break; | 113 | break; |
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c index 83ac4d3b3cb0..ba98546fabbd 100644 --- a/fs/reiserfs/journal.c +++ b/fs/reiserfs/journal.c | |||
@@ -2913,7 +2913,9 @@ int journal_init(struct super_block *sb, const char *j_dev_name, | |||
2913 | journal->j_mount_id = 10; | 2913 | journal->j_mount_id = 10; |
2914 | journal->j_state = 0; | 2914 | journal->j_state = 0; |
2915 | atomic_set(&(journal->j_jlock), 0); | 2915 | atomic_set(&(journal->j_jlock), 0); |
2916 | reiserfs_write_unlock(sb); | ||
2916 | journal->j_cnode_free_list = allocate_cnodes(num_cnodes); | 2917 | journal->j_cnode_free_list = allocate_cnodes(num_cnodes); |
2918 | reiserfs_write_lock(sb); | ||
2917 | journal->j_cnode_free_orig = journal->j_cnode_free_list; | 2919 | journal->j_cnode_free_orig = journal->j_cnode_free_list; |
2918 | journal->j_cnode_free = journal->j_cnode_free_list ? num_cnodes : 0; | 2920 | journal->j_cnode_free = journal->j_cnode_free_list ? num_cnodes : 0; |
2919 | journal->j_cnode_used = 0; | 2921 | journal->j_cnode_used = 0; |
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); |
diff --git a/fs/reiserfs/xattr_acl.c b/fs/reiserfs/xattr_acl.c index cc32e6ada67b..dd20a7883f0f 100644 --- a/fs/reiserfs/xattr_acl.c +++ b/fs/reiserfs/xattr_acl.c | |||
@@ -455,7 +455,9 @@ int reiserfs_acl_chmod(struct inode *inode) | |||
455 | return 0; | 455 | return 0; |
456 | } | 456 | } |
457 | 457 | ||
458 | reiserfs_write_unlock(inode->i_sb); | ||
458 | acl = reiserfs_get_acl(inode, ACL_TYPE_ACCESS); | 459 | acl = reiserfs_get_acl(inode, ACL_TYPE_ACCESS); |
460 | reiserfs_write_lock(inode->i_sb); | ||
459 | if (!acl) | 461 | if (!acl) |
460 | return 0; | 462 | return 0; |
461 | if (IS_ERR(acl)) | 463 | if (IS_ERR(acl)) |