aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/reiserfs/xattr.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
index bab77fe5f177..59b0850e885f 100644
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -420,10 +420,8 @@ reiserfs_xattr_set(struct inode *inode, const char *name, const void *buffer,
420 struct dentry *dentry; 420 struct dentry *dentry;
421 struct page *page; 421 struct page *page;
422 char *data; 422 char *data;
423 struct address_space *mapping;
424 size_t file_pos = 0; 423 size_t file_pos = 0;
425 size_t buffer_pos = 0; 424 size_t buffer_pos = 0;
426 struct inode *xinode;
427 struct iattr newattrs; 425 struct iattr newattrs;
428 __u32 xahash = 0; 426 __u32 xahash = 0;
429 427
@@ -441,11 +439,10 @@ reiserfs_xattr_set(struct inode *inode, const char *name, const void *buffer,
441 goto out; 439 goto out;
442 } 440 }
443 441
444 xinode = dentry->d_inode;
445 REISERFS_I(inode)->i_flags |= i_has_xattr_dir; 442 REISERFS_I(inode)->i_flags |= i_has_xattr_dir;
446 443
447 /* we need to copy it off.. */ 444 /* we need to copy it off.. */
448 if (xinode->i_nlink > 1) { 445 if (dentry->d_inode->i_nlink > 1) {
449 dput(dentry); 446 dput(dentry);
450 err = reiserfs_xattr_del(inode, name); 447 err = reiserfs_xattr_del(inode, name);
451 if (err < 0) 448 if (err < 0)
@@ -459,12 +456,11 @@ reiserfs_xattr_set(struct inode *inode, const char *name, const void *buffer,
459 /* Resize it so we're ok to write there */ 456 /* Resize it so we're ok to write there */
460 newattrs.ia_size = buffer_size; 457 newattrs.ia_size = buffer_size;
461 newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME; 458 newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME;
462 mutex_lock_nested(&xinode->i_mutex, I_MUTEX_XATTR); 459 mutex_lock_nested(&dentry->d_inode->i_mutex, I_MUTEX_XATTR);
463 err = notify_change(dentry, &newattrs); 460 err = notify_change(dentry, &newattrs);
464 if (err) 461 if (err)
465 goto out_filp; 462 goto out_filp;
466 463
467 mapping = xinode->i_mapping;
468 while (buffer_pos < buffer_size || buffer_pos == 0) { 464 while (buffer_pos < buffer_size || buffer_pos == 0) {
469 size_t chunk; 465 size_t chunk;
470 size_t skip = 0; 466 size_t skip = 0;
@@ -474,7 +470,8 @@ reiserfs_xattr_set(struct inode *inode, const char *name, const void *buffer,
474 else 470 else
475 chunk = buffer_size - buffer_pos; 471 chunk = buffer_size - buffer_pos;
476 472
477 page = reiserfs_get_page(xinode, file_pos >> PAGE_CACHE_SHIFT); 473 page = reiserfs_get_page(dentry->d_inode,
474 file_pos >> PAGE_CACHE_SHIFT);
478 if (IS_ERR(page)) { 475 if (IS_ERR(page)) {
479 err = PTR_ERR(page); 476 err = PTR_ERR(page);
480 goto out_filp; 477 goto out_filp;
@@ -521,7 +518,7 @@ reiserfs_xattr_set(struct inode *inode, const char *name, const void *buffer,
521 } 518 }
522 519
523 out_filp: 520 out_filp:
524 mutex_unlock(&xinode->i_mutex); 521 mutex_unlock(&dentry->d_inode->i_mutex);
525 dput(dentry); 522 dput(dentry);
526 523
527 out: 524 out:
@@ -541,7 +538,6 @@ reiserfs_xattr_get(const struct inode *inode, const char *name, void *buffer,
541 size_t file_pos = 0; 538 size_t file_pos = 0;
542 size_t buffer_pos = 0; 539 size_t buffer_pos = 0;
543 struct page *page; 540 struct page *page;
544 struct inode *xinode;
545 __u32 hash = 0; 541 __u32 hash = 0;
546 542
547 if (name == NULL) 543 if (name == NULL)
@@ -558,8 +554,7 @@ reiserfs_xattr_get(const struct inode *inode, const char *name, void *buffer,
558 goto out; 554 goto out;
559 } 555 }
560 556
561 xinode = dentry->d_inode; 557 isize = i_size_read(dentry->d_inode);
562 isize = xinode->i_size;
563 REISERFS_I(inode)->i_flags |= i_has_xattr_dir; 558 REISERFS_I(inode)->i_flags |= i_has_xattr_dir;
564 559
565 /* Just return the size needed */ 560 /* Just return the size needed */
@@ -582,7 +577,8 @@ reiserfs_xattr_get(const struct inode *inode, const char *name, void *buffer,
582 else 577 else
583 chunk = isize - file_pos; 578 chunk = isize - file_pos;
584 579
585 page = reiserfs_get_page(xinode, file_pos >> PAGE_CACHE_SHIFT); 580 page = reiserfs_get_page(dentry->d_inode,
581 file_pos >> PAGE_CACHE_SHIFT);
586 if (IS_ERR(page)) { 582 if (IS_ERR(page)) {
587 err = PTR_ERR(page); 583 err = PTR_ERR(page);
588 goto out_dput; 584 goto out_dput;