xfs
[Top] [All Lists]

[PATCH] xfsdump: add locks around the inventory put

To: xfs-oss <xfs@xxxxxxxxxxx>
Subject: [PATCH] xfsdump: add locks around the inventory put
From: Rich Johnston <rjohnston@xxxxxxx>
Date: Tue, 1 Oct 2013 11:30:59 -0500
Delivered-to: xfs@xxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.0
From: Phil White <cerise-xfs@xxxxxxxxxxxx>

Add locks around the inventory put to prevent inventory
corruption.

Signed-off-by: Phil White <cerise-xfs@xxxxxxxxxxxx>

diff --git a/dump/content.c b/dump/content.c
index ac19021..b8977bb 100644
--- a/dump/content.c
+++ b/dump/content.c
@@ -2550,8 +2550,11 @@ decision_more:
                                       scwhdrp->cih_startpt.sp_offset );
                        }

-                       /* already thread-safe, don't need to lock
+                       /* Supposedly already thread-safe, according to the
+                        * previous revisions, but corruption of inventory
+                        * objects can occur.
                         */
                         */
+                       lock();
                        ok = inv_put_mediafile( inv_stmt,
                                                &mwhdrp->mh_mediaid,
                                                mwhdrp->mh_medialabel,
@@ -2565,6 +2568,7 @@ decision_more:
                                                &&
                                                ! empty_mediafile,
                                                BOOL_FALSE );
+                       unlock();
                        if ( ! ok ) {
                                mlog( MLOG_NORMAL, _(
                                      "inventory media file put failed\n") );

<Prev in Thread] Current Thread [Next in Thread>