aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/xattr.c
diff options
context:
space:
mode:
authorTao Ma <tao.ma@oracle.com>2010-05-10 06:09:47 -0400
committerJoel Becker <joel.becker@oracle.com>2010-05-18 19:41:21 -0400
commitd5a7df0649fa6a1e7800785d760e2c7d7a3204de (patch)
tree35df1668e3d68dd71789e88bd9c01f914a811607 /fs/ocfs2/xattr.c
parent41841b0bcea8af7f3bff8b2a23d542b94d9c1bb1 (diff)
ocfs2: Reset xattr value size after xa_cleanup_value_truncate().
In ocfs2_prepare_xattr_entry, if we fail to grow an existing value, xa_cleanup_value_truncate() will leave the old entry in place. Thus, we reset its value size. However, if we were allocating a new value, we must not reset the value size or we will BUG(). This resolves oss.oracle.com bug 1247. Signed-off-by: Tao Ma <tao.ma@oracle.com> Signed-off-by: Joel Becker <joel.becker@oracle.com>
Diffstat (limited to 'fs/ocfs2/xattr.c')
-rw-r--r--fs/ocfs2/xattr.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c
index a1cf195935cf..e87130f44cb7 100644
--- a/fs/ocfs2/xattr.c
+++ b/fs/ocfs2/xattr.c
@@ -2135,15 +2135,18 @@ alloc_value:
2135 orig_clusters = ocfs2_xa_value_clusters(loc); 2135 orig_clusters = ocfs2_xa_value_clusters(loc);
2136 rc = ocfs2_xa_value_truncate(loc, xi->xi_value_len, ctxt); 2136 rc = ocfs2_xa_value_truncate(loc, xi->xi_value_len, ctxt);
2137 if (rc < 0) { 2137 if (rc < 0) {
2138 /*
2139 * If we tried to grow an existing external value,
2140 * ocfs2_xa_cleanuP-value_truncate() is going to
2141 * let it stand. We have to restore its original
2142 * value size.
2143 */
2144 loc->xl_entry->xe_value_size = orig_value_size;
2145 ocfs2_xa_cleanup_value_truncate(loc, "growing", 2138 ocfs2_xa_cleanup_value_truncate(loc, "growing",
2146 orig_clusters); 2139 orig_clusters);
2140 /*
2141 * If we were growing an existing value,
2142 * ocfs2_xa_cleanup_value_truncate() won't remove
2143 * the entry. We need to restore the original value
2144 * size.
2145 */
2146 if (loc->xl_entry) {
2147 BUG_ON(!orig_value_size);
2148 loc->xl_entry->xe_value_size = orig_value_size;
2149 }
2147 mlog_errno(rc); 2150 mlog_errno(rc);
2148 } 2151 }
2149 } 2152 }