ocfs2-devel.oss.oracle.com archive mirror
 help / color / mirror / Atom feed
* [Ocfs2-devel] [PATCH] ocfs2: Reset xattr value size after xa_cleanup_value_truncate.
@ 2010-05-10 10:09 Tao Ma
  2010-05-10 18:41 ` Joel Becker
  0 siblings, 1 reply; 2+ messages in thread
From: Tao Ma @ 2010-05-10 10:09 UTC (permalink / raw)
  To: ocfs2-devel

In ocfs2_prepare_xattr_entry, if we fail to xa_cleanup_value_truncate,
we need to reset its value size in case we don't remove the xattr
entry. This resolves oss bug 1247.

Signed-off-by: Tao Ma <tao.ma@oracle.com>
---
 fs/ocfs2/xattr.c |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
index a1cf195..e87130f 100644
--- a/fs/ocfs2/xattr.c
+++ b/fs/ocfs2/xattr.c
@@ -2135,15 +2135,18 @@ alloc_value:
 		orig_clusters = ocfs2_xa_value_clusters(loc);
 		rc = ocfs2_xa_value_truncate(loc, xi->xi_value_len, ctxt);
 		if (rc < 0) {
-			/*
-			 * If we tried to grow an existing external value,
-			 * ocfs2_xa_cleanuP-value_truncate() is going to
-			 * let it stand.  We have to restore its original
-			 * value size.
-			 */
-			loc->xl_entry->xe_value_size = orig_value_size;
 			ocfs2_xa_cleanup_value_truncate(loc, "growing",
 							orig_clusters);
+			/*
+			 * If we were growing an existing value,
+			 * ocfs2_xa_cleanup_value_truncate() won't remove
+			 * the entry. We need to restore the original value
+			 * size.
+			 */
+			if (loc->xl_entry) {
+				BUG_ON(!orig_value_size);
+				loc->xl_entry->xe_value_size = orig_value_size;
+			}
 			mlog_errno(rc);
 		}
 	}
-- 
1.5.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [Ocfs2-devel] [PATCH] ocfs2: Reset xattr value size after xa_cleanup_value_truncate.
  2010-05-10 10:09 [Ocfs2-devel] [PATCH] ocfs2: Reset xattr value size after xa_cleanup_value_truncate Tao Ma
@ 2010-05-10 18:41 ` Joel Becker
  0 siblings, 0 replies; 2+ messages in thread
From: Joel Becker @ 2010-05-10 18:41 UTC (permalink / raw)
  To: ocfs2-devel

On Mon, May 10, 2010 at 06:09:47PM +0800, Tao Ma wrote:
> In ocfs2_prepare_xattr_entry, if we fail to xa_cleanup_value_truncate,
> we need to reset its value size in case we don't remove the xattr
> entry. This resolves oss bug 1247.
> 
> Signed-off-by: Tao Ma <tao.ma@oracle.com>

This patch is now in the 'fixes' branch of ocfs2.git.

Joel

-- 

"It is not the function of our government to keep the citizen from
 falling into error; it is the function of the citizen to keep the
 government from falling into error."
	- Robert H. Jackson

Joel Becker
Principal Software Developer
Oracle
E-mail: joel.becker at oracle.com
Phone: (650) 506-8127

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-05-10 18:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-10 10:09 [Ocfs2-devel] [PATCH] ocfs2: Reset xattr value size after xa_cleanup_value_truncate Tao Ma
2010-05-10 18:41 ` Joel Becker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).