From: Rene Cougnenc (rene.cougnenc@lill.frmug.fr.mugnet.org)
Date: 02/16/93


From: rene.cougnenc@lill.frmug.fr.mugnet.org (Rene Cougnenc) 
Subject: Bug fix of xiafs-0.7
Date: 16 Feb 1993 23:26:00 GMT

Cher Christian Perrier,
Dans un message du 16 Fevrier, vous ecrivez :

(Andouille, j'avais pas vu le sujet du message... et je l'ai recopie
 automatiquement b^etement ! )

CP > XIALFS07.ZIP : oine more file system pour Linux. Ce sont des trucs pris
CP > en vrac..a trier....

Puisque tu fais de la pub pour ce fichier, je suis OBLIGE de diffuser le
message qui va avec:

=========================================================================
Date: Mon, 15 Feb 1993 15:00:41 GMT

A bug in the kernel part of xiafs was found yesterday.
This bug may trush multi-block directory if you delete and
create files many times.
The following is the fix. Upgrade is strongly recommanded.

move this file to linux/fs/xiafs dir to apply the patch.

-Frank Xia Mon Feb 15, 1993

=========================================================================
diff -cr namei.c~ namei.c
*** namei.c~ Sun Feb 14 22:54:34 1993
--- namei.c Sun Feb 14 22:17:37 1993
***************
*** 20,26 ****
  
  #include "xfs_mac.h"
  
! #define RNDUP4(x) (((x) + 3) & ~3)
  /*
   * ok, we cannot use strncmp, as the name is not in our data space.
   * Thus we'll have to use xfs_match. No big problem. Match also makes
--- 20,26 ----
  
  #include "xfs_mac.h"
  
! #define RNDUP4(x) ((3+(u_long)(x)) & ~3)
  /*
   * ok, we cannot use strncmp, as the name is not in our data space.
   * Thus we'll have to use xfs_match. No big problem. Match also makes
***************
*** 206,212 ****
                    brelse(bh);
                    return NULL;
                }
! if (RNDUP4(de->d_name_len)+RNDUP4(namelen)+16<=de->d_rec_len) {
                    i=RNDUP4(de->d_name_len)+8;
                    de2=(struct xfs_direct *)(i+(u_char *)de);
                    de2->d_ino=0;
--- 206,213 ----
                    brelse(bh);
                    return NULL;
                }
! if (de->d_ino &&
! RNDUP4(de->d_name_len)+RNDUP4(namelen)+16<=de->d_rec_len) {
                    i=RNDUP4(de->d_name_len)+8;
                    de2=(struct xfs_direct *)(i+(u_char *)de);
                    de2->d_ino=0;
***************
*** 215,221 ****
                    de=de2;
                }
            }
! if (!de->d_ino) {
                dir->i_mtime = CURRENT_TIME;
                dir->i_dirt = 1;
                memcpy(de->d_name, name_buffer, namelen);
--- 216,222 ----
                    de=de2;
                }
            }
! if (!de->d_ino && (RNDUP4(namelen)+8 <= de->d_rec_len)) {
                dir->i_mtime = CURRENT_TIME;
                dir->i_dirt = 1;
                memcpy(de->d_name, name_buffer, namelen);