xfs
[Top] [All Lists]

RE: Zero filled files

To: "'Christoph Hellwig'" <hch@xxxxxxxxxxxxx>
Subject: RE: Zero filled files
From: Murthy Kambhampaty <murthy.kambhampaty@xxxxxxxxx>
Date: Wed, 14 May 2003 13:27:30 -0400
Cc: linux-xfs@xxxxxxxxxxx
Sender: linux-xfs-bounce@xxxxxxxxxxx
Christoph, thanks for the patch. I tried to apply it to a 2.4.20 kernel with
the latest available xfs-2.4.20 patches applied and I got a couple of
rejects. I hand edited around the rejects, rather blindly, but the resulting
kernel won't boot. LILO gives an "Error: 0x10" and drops me to a boot prompt
from which I can boot my old kernel. Info on the rejs and hand-edits is
attached:

$ cat ../xfs_CH_patch_200305151748 | patch -p1
patching file fs/xfs/xfs_log.c
Hunk #1 succeeded at 834 (offset -18 lines).
patching file fs/xfs/xfs_mount.c
Hunk #1 succeeded at 114 (offset -26 lines).
Hunk #3 succeeded at 1595 (offset 11 lines).
Hunk #4 succeeded at 1596 with fuzz 2.
Hunk #5 FAILED at 1606.
1 out of 5 hunks FAILED -- saving rejects to file fs/xfs/xfs_mount.c.rej
patching file fs/xfs/xfs_mount.h
Hunk #1 FAILED at 378.
1 out of 1 hunk FAILED -- saving rejects to file fs/xfs/xfs_mount.h.rej
$

I hand edited for the two rejs as follows:
$ diff fs/xfs/xfs_mount.c.old fs/xfs/xfs_mount.c
1620,1631c1620,1621
<       SPLDECL(s);
<
<       if (mp->m_frozen) {
<               s = mutex_spinlock(&mp->m_freeze_lock);
<
<               if (mp->m_frozen < level) {
<                       mutex_spinunlock(&mp->m_freeze_lock, s);
<               } else {
<                       sv_wait(&mp->m_wait_unfreeze, 0, &mp->m_freeze_lock,
s);
<               }
<       }
<
---
>       wait_event(mp->m_wait_unfreeze,
>               (atomic_read(&mp->m_frozen) < level));


# Lines 379,388 in xfs_mount.h now read:
        struct xfs_dmops        m_dm_ops;       /* vector of DMI ops */
        struct xfs_qmops        m_qm_ops;       /* vector of XQM ops */
        struct xfs_ioops        m_io_ops;       /* vector of I/O ops */
        atomic_t                m_frozen;       /* FS frozen for shutdown or
                                                 * snapshot */
        wait_queue_head_t       m_wait_unfreeze;/* waiting to unfreeze */
        atomic_t                m_active_trans; /* number trans frozen */
        struct timer_list       m_sbdirty_timer;/* superblock dirty timer
                                                 * for nfs refcache */
} xfs_mount_t;

Note the 
"        struct timer_list       m_sbdirty_timer;/* superblock dirty timer
                                                 * for nfs refcache */"
which was not in the xfs_mount.h on which the patch was generated.

Any thoughts on how I might proceed, short of getting the latest from CVS.
(I'd like to see if I can work this "fix" into a 2.4.19-xfs-1.2.0 kernel for
our production server, until 1.2.1 comes out, so I'm willing to work on this
if you have any ideas. Of course, you'll be leading the blind ... )

Thanks again,
        Murthy


>-----Original Message-----
>From: Christoph Hellwig [mailto:hch@xxxxxxxxxxxxx]
>Sent: Monday, May 12, 2003 17:48
>To: Murthy Kambhampaty
>Cc: 'Steve Lord'; linux-xfs@xxxxxxxxxxx
>Subject: Re: Zero filled files
>
>
>Could you please try the ttached patch?  (against TOT but 
>should also work with
>older codebases)
>
>
>--- 1.13/fs/xfs/xfs_log.c      Fri May  2 22:01:27 2003
>+++ edited/fs/xfs/xfs_log.c    Mon May 12 01:43:06 2003
>@@ -852,7 +852,7 @@
>       int             needed = 0, gen;
>       xlog_t          *log = mp->m_log;
> 
>-      if (mp->m_frozen || XFS_FORCED_SHUTDOWN(mp))
>+      if (atomic_read(&mp->m_frozen) || XFS_FORCED_SHUTDOWN(mp))
>               return 0;
> 
>       s = LOG_LOCK(log);
>--- 1.27/fs/xfs/xfs_mount.c    Fri May  2 22:01:28 2003
>+++ edited/fs/xfs/xfs_mount.c  Mon May 12 01:45:21 2003
>@@ -140,8 +140,7 @@
>       xfs_trans_ail_init(mp);
> 
>       /* Init freeze sync structures */
>-      spinlock_init(&mp->m_freeze_lock, "xfs_freeze");
>-      init_sv(&mp->m_wait_unfreeze, SV_DEFAULT, "xfs_freeze", 0);
>+      init_waitqueue_head(&mp->m_wait_unfreeze);
>       atomic_set(&mp->m_active_trans, 0);
> 
>       return mp;
>@@ -192,7 +191,6 @@
>       }
> 
>       spinlock_destroy(&mp->m_freeze_lock);
>-      sv_destroy(&mp->m_wait_unfreeze);
>       kmem_free(mp, sizeof(xfs_mount_t));
> }
> 
>@@ -1586,10 +1584,7 @@
>       xfs_mount_t     *mp,
>       int             level)
> {
>-      unsigned long   s = mutex_spinlock(&mp->m_freeze_lock);
>-
>-      mp->m_frozen = level;
>-      mutex_spinunlock(&mp->m_freeze_lock, s);
>+      atomic_set(&mp->m_frozen, level);
> 
>       if (level == XFS_FREEZE_TRANS) {
>               while (atomic_read(&mp->m_active_trans) > 0)
>@@ -1601,14 +1596,8 @@
> xfs_finish_freeze(
>       xfs_mount_t     *mp)
> {
>-      unsigned long   s = mutex_spinlock(&mp->m_freeze_lock);
>-
>-      if (mp->m_frozen) {
>-              mp->m_frozen = 0;
>-              sv_broadcast(&mp->m_wait_unfreeze);
>-      }
>-
>-      mutex_spinunlock(&mp->m_freeze_lock, s);
>+      atomic_set(&mp->m_frozen, 0);
>+      wake_up(&mp->m_wait_unfreeze);
> }
> 
> void
>@@ -1617,18 +1606,8 @@
>       bhv_desc_t      *bdp,
>       int             level)
> {
>-      unsigned long   s;
>-
>-      if (mp->m_frozen) {
>-              s = mutex_spinlock(&mp->m_freeze_lock);
>-
>-              if (mp->m_frozen < level) {
>-                      mutex_spinunlock(&mp->m_freeze_lock, s);
>-              } else {
>-                      sv_wait(&mp->m_wait_unfreeze, 0, 
>&mp->m_freeze_lock, s);
>-              }
>-      }
>-
>+      wait_event(mp->m_wait_unfreeze,
>+                      (atomic_read(&mp->m_frozen) < level));
>       if (level == XFS_FREEZE_TRANS)
>               atomic_inc(&mp->m_active_trans);
> }
>--- 1.13/fs/xfs/xfs_mount.h    Fri May  2 21:36:12 2003
>+++ edited/fs/xfs/xfs_mount.h  Mon May 12 01:32:45 2003
>@@ -378,10 +378,9 @@
>       struct xfs_dmops        m_dm_ops;       /* vector of DMI ops */
>       struct xfs_qmops        m_qm_ops;       /* vector of XQM ops */
>       struct xfs_ioops        m_io_ops;       /* vector of I/O ops */
>-      lock_t                  m_freeze_lock;  /* Lock for m_frozen */
>-      uint                    m_frozen;       /* FS frozen 
>for shutdown or
>+      atomic_t                m_frozen;       /* FS frozen 
>for shutdown or
>                                                * snapshot */
>-      sv_t                    m_wait_unfreeze;/* waiting to 
>unfreeze */
>+      wait_queue_head_t       m_wait_unfreeze;/* waiting to 
>unfreeze */
>       atomic_t                m_active_trans; /* number trans 
>frozen */
> } xfs_mount_t;
> 
>


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