[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-xfs
Subject:    Re: DMAPI & NOSPACE data corruption.
From:       Dean Roehrich <roehrich () sgi ! com>
Date:       2005-02-28 16:38:37
Message-ID: 20050228163837.877AF4FDD0 () chewtoy ! americas ! sgi ! com
[Download RAW message or body]

>From:  Kenji Munakata <munaken@sys1.cpg.sony.co.jp>
>Hi there,
>
>I found that data & size corrupting when the ENOSPC(with DMAPI) retrial succee
>ds.
>It seems that data offset is not reset at retry.
>following patches are appended. 
>
>--- xfs_lrw.c.ORG       2005-02-28 11:56:18.405763312 +0900
>+++ xfs_lrw.c   2005-02-28 11:57:07.543293272 +0900
>@@ -862,24 +862,25 @@
>        if ((ret == -ENOSPC) &&
>            DM_EVENT_ENABLED(vp->v_vfsp, xip, DM_EVENT_NOSPACE) &&
>            !(ioflags & IO_INVIS)) {
> 
>                xfs_rwunlock(bdp, locktype);
>                error = XFS_SEND_NAMESP(xip->i_mount, DM_EVENT_NOSPACE, vp,
>                                DM_RIGHT_NULL, vp, DM_RIGHT_NULL, NULL, NULL,
>                                0, 0, 0); /* Delay flag intentionally  unused 
>*/
>                if (error)
>                        goto out_unlock_isem;
>                xfs_rwlock(bdp, locktype);
>                pos = xip->i_d.di_size;
>+               ret = 0;
>                goto retry;
>        }


This looks like code for the 2.6 kernel.

In xfs_write I see that when we jump to 'retry', 'ret' will be used as an
lvalue before it is tested again.

Maybe 'pos' is not being set properly?  Is di_size changing?  It can, given
that this thread may not hold any locks while it was in the DMAPI queues to
deliver the NOSPACE event--there's nothing to prevent another thread from
coming in and changing the size of the file before you can fully unwind from
delivering the NOSPACE event.

It looks like we sometimes hold i_sem while delivering NOSPACE.  Have to fix
that, too.  Do you know if need_isem was set when you delivered NOSPACE?

Dean


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic