xfs
[Top] [All Lists]

Re: [PATCH] xfsdump: add locks around the inventory put

To: Rich Johnston <rjohnston@xxxxxxx>
Subject: Re: [PATCH] xfsdump: add locks around the inventory put
From: Eric Sandeen <sandeen@xxxxxxxxxxx>
Date: Tue, 01 Oct 2013 16:06:36 -0500
Cc: xfs-oss <xfs@xxxxxxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <524AF8C3.8020904@xxxxxxx>
References: <524AF8C3.8020904@xxxxxxx>
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130801 Thunderbird/17.0.8
hi Rich -

On 10/1/13 11:30 AM, Rich Johnston wrote:
> From: Phil White <cerise-xfs@xxxxxxxxxxxx>
> 
> Add locks around the inventory put to prevent inventory
> corruption.
> 
> Signed-off-by: Phil White <cerise-xfs@xxxxxxxxxxxx>

Similar questions here; it says it's thread-safe, but apparently
not.  But why not?  what happens?  Is there a testcase?

(you guys probably have longer history in ptools, maybe you
can see what if anything changed since the original comment
was added - or maybe when it was added, etc?)

Thanks,
-Eric

> 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") );
> 
> _______________________________________________
> xfs mailing list
> xfs@xxxxxxxxxxx
> http://oss.sgi.com/mailman/listinfo/xfs
> 

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