aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext2/xattr.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext2/xattr.c')
-rw-r--r--fs/ext2/xattr.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c
index 7913531ec6d5..e44dc92609be 100644
--- a/fs/ext2/xattr.c
+++ b/fs/ext2/xattr.c
@@ -60,6 +60,7 @@
60#include <linux/mbcache.h> 60#include <linux/mbcache.h>
61#include <linux/quotaops.h> 61#include <linux/quotaops.h>
62#include <linux/rwsem.h> 62#include <linux/rwsem.h>
63#include <linux/security.h>
63#include "ext2.h" 64#include "ext2.h"
64#include "xattr.h" 65#include "xattr.h"
65#include "acl.h" 66#include "acl.h"
@@ -249,8 +250,9 @@ cleanup:
249 * used / required on success. 250 * used / required on success.
250 */ 251 */
251static int 252static int
252ext2_xattr_list(struct inode *inode, char *buffer, size_t buffer_size) 253ext2_xattr_list(struct dentry *dentry, char *buffer, size_t buffer_size)
253{ 254{
255 struct inode *inode = dentry->d_inode;
254 struct buffer_head *bh = NULL; 256 struct buffer_head *bh = NULL;
255 struct ext2_xattr_entry *entry; 257 struct ext2_xattr_entry *entry;
256 char *end; 258 char *end;
@@ -300,9 +302,10 @@ bad_block: ext2_error(inode->i_sb, "ext2_xattr_list",
300 ext2_xattr_handler(entry->e_name_index); 302 ext2_xattr_handler(entry->e_name_index);
301 303
302 if (handler) { 304 if (handler) {
303 size_t size = handler->list(inode, buffer, rest, 305 size_t size = handler->list(dentry, buffer, rest,
304 entry->e_name, 306 entry->e_name,
305 entry->e_name_len); 307 entry->e_name_len,
308 handler->flags);
306 if (buffer) { 309 if (buffer) {
307 if (size > rest) { 310 if (size > rest) {
308 error = -ERANGE; 311 error = -ERANGE;
@@ -330,7 +333,7 @@ cleanup:
330ssize_t 333ssize_t
331ext2_listxattr(struct dentry *dentry, char *buffer, size_t size) 334ext2_listxattr(struct dentry *dentry, char *buffer, size_t size)
332{ 335{
333 return ext2_xattr_list(dentry->d_inode, buffer, size); 336 return ext2_xattr_list(dentry, buffer, size);
334} 337}
335 338
336/* 339/*
@@ -641,8 +644,8 @@ ext2_xattr_set2(struct inode *inode, struct buffer_head *old_bh,
641 the inode. */ 644 the inode. */
642 ea_bdebug(new_bh, "reusing block"); 645 ea_bdebug(new_bh, "reusing block");
643 646
644 error = -EDQUOT; 647 error = dquot_alloc_block(inode, 1);
645 if (vfs_dq_alloc_block(inode, 1)) { 648 if (error) {
646 unlock_buffer(new_bh); 649 unlock_buffer(new_bh);
647 goto cleanup; 650 goto cleanup;
648 } 651 }
@@ -699,7 +702,7 @@ ext2_xattr_set2(struct inode *inode, struct buffer_head *old_bh,
699 * as if nothing happened and cleanup the unused block */ 702 * as if nothing happened and cleanup the unused block */
700 if (error && error != -ENOSPC) { 703 if (error && error != -ENOSPC) {
701 if (new_bh && new_bh != old_bh) 704 if (new_bh && new_bh != old_bh)
702 vfs_dq_free_block(inode, 1); 705 dquot_free_block(inode, 1);
703 goto cleanup; 706 goto cleanup;
704 } 707 }
705 } else 708 } else
@@ -731,7 +734,7 @@ ext2_xattr_set2(struct inode *inode, struct buffer_head *old_bh,
731 le32_add_cpu(&HDR(old_bh)->h_refcount, -1); 734 le32_add_cpu(&HDR(old_bh)->h_refcount, -1);
732 if (ce) 735 if (ce)
733 mb_cache_entry_release(ce); 736 mb_cache_entry_release(ce);
734 vfs_dq_free_block(inode, 1); 737 dquot_free_block(inode, 1);
735 mark_buffer_dirty(old_bh); 738 mark_buffer_dirty(old_bh);
736 ea_bdebug(old_bh, "refcount now=%d", 739 ea_bdebug(old_bh, "refcount now=%d",
737 le32_to_cpu(HDR(old_bh)->h_refcount)); 740 le32_to_cpu(HDR(old_bh)->h_refcount));
@@ -794,7 +797,7 @@ ext2_xattr_delete_inode(struct inode *inode)
794 mark_buffer_dirty(bh); 797 mark_buffer_dirty(bh);
795 if (IS_SYNC(inode)) 798 if (IS_SYNC(inode))
796 sync_dirty_buffer(bh); 799 sync_dirty_buffer(bh);
797 vfs_dq_free_block(inode, 1); 800 dquot_free_block(inode, 1);
798 } 801 }
799 EXT2_I(inode)->i_file_acl = 0; 802 EXT2_I(inode)->i_file_acl = 0;
800 803