소스 검색

ocfs2/xattr: Restore not_found in xis

During an xattr set, when we move a xattr which was stored in inode to the
outside bucket, we have to delete it and it will use the old value of
xis->not_found. xis->not_found is removed by ocfs2_calc_xattr_set_need
though, so we must restore it.

Signed-off-by: Tao Ma <tao.ma@oracle.com>
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Tao Ma 16 년 전
부모
커밋
9f868f16e4
1개의 변경된 파일5개의 추가작업 그리고 1개의 파일을 삭제
  1. 5 1
      fs/ocfs2/xattr.c

+ 5 - 1
fs/ocfs2/xattr.c

@@ -2414,7 +2414,7 @@ static int __ocfs2_xattr_set_handle(struct inode *inode,
 				    struct ocfs2_xattr_search *xbs,
 				    struct ocfs2_xattr_search *xbs,
 				    struct ocfs2_xattr_set_ctxt *ctxt)
 				    struct ocfs2_xattr_set_ctxt *ctxt)
 {
 {
-	int ret = 0, credits;
+	int ret = 0, credits, old_found;
 
 
 	if (!xi->value) {
 	if (!xi->value) {
 		/* Remove existing extended attribute */
 		/* Remove existing extended attribute */
@@ -2433,6 +2433,7 @@ static int __ocfs2_xattr_set_handle(struct inode *inode,
 			xi->value = NULL;
 			xi->value = NULL;
 			xi->value_len = 0;
 			xi->value_len = 0;
 
 
+			old_found = xis->not_found;
 			xis->not_found = -ENODATA;
 			xis->not_found = -ENODATA;
 			ret = ocfs2_calc_xattr_set_need(inode,
 			ret = ocfs2_calc_xattr_set_need(inode,
 							di,
 							di,
@@ -2442,6 +2443,7 @@ static int __ocfs2_xattr_set_handle(struct inode *inode,
 							NULL,
 							NULL,
 							NULL,
 							NULL,
 							&credits);
 							&credits);
+			xis->not_found = old_found;
 			if (ret) {
 			if (ret) {
 				mlog_errno(ret);
 				mlog_errno(ret);
 				goto out;
 				goto out;
@@ -2462,6 +2464,7 @@ static int __ocfs2_xattr_set_handle(struct inode *inode,
 				if (ret)
 				if (ret)
 					goto out;
 					goto out;
 
 
+				old_found = xis->not_found;
 				xis->not_found = -ENODATA;
 				xis->not_found = -ENODATA;
 				ret = ocfs2_calc_xattr_set_need(inode,
 				ret = ocfs2_calc_xattr_set_need(inode,
 								di,
 								di,
@@ -2471,6 +2474,7 @@ static int __ocfs2_xattr_set_handle(struct inode *inode,
 								NULL,
 								NULL,
 								NULL,
 								NULL,
 								&credits);
 								&credits);
+				xis->not_found = old_found;
 				if (ret) {
 				if (ret) {
 					mlog_errno(ret);
 					mlog_errno(ret);
 					goto out;
 					goto out;