Whamcloud - gitweb
update b_size from HEAD (20040213_2304)
authornic <nic>
Sat, 14 Feb 2004 07:24:26 +0000 (07:24 +0000)
committernic <nic>
Sat, 14 Feb 2004 07:24:26 +0000 (07:24 +0000)
35 files changed:
lnet/klnds/gmlnd/gmlnd_comm.c
lnet/klnds/iblnd/ibnal_cb.c
lustre/include/linux/lustre_user.h
lustre/kernel_patches/patches/ext3-xattr-ptr-arith-fix.patch
lustre/kernel_patches/patches/iopen-2.4.18-2.patch
lustre/kernel_patches/patches/iopen-2.4.19-suse.patch
lustre/kernel_patches/patches/vfs_intent-2.4.19-pre1.patch
lustre/kernel_patches/patches/vfs_intent-2.4.19-suse.patch
lustre/kernel_patches/patches/vfs_intent-2.4.22-rh.patch
lustre/kernel_patches/patches/vfs_intent_2.6.0-test6.patch
lustre/kernel_patches/series/bproc-2.4.20-hp-pnnl
lustre/kernel_patches/series/chaos-2.4.18-pdirops
lustre/kernel_patches/series/suse-2.4.19
lustre/liblustre/genlib.sh
lustre/liblustre/namei.c
lustre/liblustre/recovery_small.c [deleted file]
lustre/liblustre/replay_single.c [deleted file]
lustre/liblustre/test_common.c [deleted file]
lustre/liblustre/test_common.h [deleted file]
lustre/liblustre/test_lock_cancel.c [deleted file]
lustre/llite/rw26.c
lustre/lvfs/Makefile.am
lustre/mds/mds_log.c
lustre/mgmt/mgmt_svc.c
lustre/obdclass/llog.c
lustre/obdfilter/filter_io_26.c
lustre/portals/knals/gmnal/gmnal_comm.c
lustre/portals/knals/ibnal/ibnal_cb.c
lustre/ptlrpc/import.c
lustre/ptlrpc/llog_net.c
lustre/scripts/lmake
lustre/tests/cfg/mdev.sh
lustre/tests/conf-sanity.sh
lustre/utils/lrun
lustre/utils/wirehdr.c

index 4171df6..a0d3530 100644 (file)
@@ -321,7 +321,6 @@ gmnal_small_rx(nal_cb_t *nal_cb, void *private, lib_msg_t *cookie,
 
        if (!private) {
                CDEBUG(D_ERROR, "gmnal_small_rx no context\n");
-               lib_finalize(nal_cb, private, cookie);
                return(PTL_FAIL);
        }
 
@@ -343,10 +342,8 @@ gmnal_small_rx(nal_cb_t *nal_cb, void *private, lib_msg_t *cookie,
         *      let portals library know receive is complete
         */
        CDEBUG(D_PORTALS, "calling lib_finalize\n");
-       if (lib_finalize(nal_cb, private, cookie) != PTL_OK) {
-               /* TO DO what to do with failed lib_finalise? */
-               CDEBUG(D_INFO, "lib_finalize failed\n");
-       }
+       lib_finalize(nal_cb, private, cookie, PTL_OK);
+
        /*
         *      return buffer so it can be used again
         */
@@ -590,10 +587,8 @@ gmnal_small_tx_callback(gm_port_t *gm_port, void *context, gm_status_t status)
                return;
        }
        gmnal_return_stxd(nal_data, stxd);
-       if (lib_finalize(nal_cb, stxd, cookie) != PTL_OK) {
-               CDEBUG(D_INFO, "Call to lib_finalize failed for stxd [%p]\n", 
-                      stxd);
-       }
+       lib_finalize(nal_cb, stxd, cookie, PTL_OK);
+
        return;
 }
 
@@ -817,7 +812,6 @@ gmnal_large_rx(nal_cb_t *nal_cb, void *private, lib_msg_t *cookie,
 
        if (!srxd) {
                CDEBUG(D_ERROR, "gmnal_large_rx no context\n");
-               lib_finalize(nal_cb, private, cookie);
                return(PTL_FAIL);
        }
 
@@ -1114,10 +1108,7 @@ gmnal_remote_get_callback(gm_port_t *gm_port, void *context,
         *      Let our client application proceed
         */     
        CDEBUG(D_ERROR, "final callback context[%p]\n", srxd);
-       if (lib_finalize(nal_cb, srxd, srxd->cookie) != PTL_OK) {
-               CDEBUG(D_INFO, "Call to lib_finalize failed for srxd [%p]\n", 
-                      srxd);
-       }
+       lib_finalize(nal_cb, srxd, srxd->cookie, PTL_OK);
 
        /*
         *      send an ack to the sender to let him know we got the data
@@ -1282,10 +1273,7 @@ gmnal_large_tx_ack_received(gmnal_data_t *nal_data, gmnal_srxd_t *srxd)
 
        CDEBUG(D_INFO, "gmnal_large_tx_ack_received stxd [%p]\n", stxd);
 
-       if (lib_finalize(nal_cb, stxd, stxd->cookie) != PTL_OK) {
-               CDEBUG(D_INFO, "Call to lib_finalize failed for stxd [%p]\n", 
-                      stxd);
-       }
+       lib_finalize(nal_cb, stxd, stxd->cookie, PTL_OK);
 
        /*
         *      extract the iovec from the stxd, deregister the memory.
index 2c07cc4..0688062 100644 (file)
@@ -306,7 +306,7 @@ kibnal_send(nal_cb_t        *nal,
           if(buf_length > MAX_MSG_SIZE) { 
              CERROR("kibnal_send:request exceeds Transmit data size (%d).\n",
                       MAX_MSG_SIZE);
-             rc = -1;
+             rc = PTL_FAIL;
              return rc;
           }
           else {
@@ -363,7 +363,7 @@ kibnal_send(nal_cb_t        *nal,
 
         PROF_FINISH(kibnal_send); // time stapm of send operation 
 
-        rc = 1;
+        rc = PTL_OK;
 
         return rc; 
 }
@@ -386,7 +386,7 @@ int kibnal_send_pages(nal_cb_t * nal,
                       ptl_kiov_t *iov, 
                       size_t mlen)
 {
-   int rc = 1;
+   int rc = PTL_FAIL;
 
    CDEBUG(D_NET, "kibnal_send_pages\n");
 
@@ -420,7 +420,7 @@ void kibnal_fwd_packet (void *arg, kpr_fwd_desc_t *fwd)
 //
 // do you need this 
 //
-int kibnal_callback(nal_cb_t * nal, 
+void kibnal_callback(nal_cb_t * nal, 
                            void *private, 
                            lib_eq_t *eq,
                            ptl_event_t *ev)
@@ -507,7 +507,7 @@ kibnal_recv_pages(nal_cb_t * nal,
 {
 
   CDEBUG(D_NET, "recv_pages not implemented\n");
-  return PTL_OK;
+  return PTL_FAIL;
        
 }
 
@@ -526,11 +526,12 @@ kibnal_recv(nal_cb_t     *nal,
         CDEBUG(D_NET,"kibnal_recv: mlen=%d, rlen=%d\n", mlen, rlen);
 
         /* What was actually received must be >= what sender claims to
-         * have sent.  This is an LASSERT, since lib-move doesn't
-         * check cb return code yet. */
-        LASSERT (krx->krx_len >= sizeof (ptl_hdr_t) + rlen);
+         * have sent. */
         LASSERT (mlen <= rlen);
 
+        if (krx->krx_len < sizeof (ptl_hdr_t) + rlen)
+                return (PTL_FAIL);
+
         PROF_START(kibnal_recv);
 
         if(mlen != 0) {
@@ -542,12 +543,12 @@ kibnal_recv(nal_cb_t     *nal,
 
         PROF_START(lib_finalize);
         
-        lib_finalize(nal, private, cookie);
+        lib_finalize(nal, private, cookie, PTL_OK);
         
         PROF_FINISH(lib_finalize);
         PROF_FINISH(kibnal_recv);
 
-        return rlen;
+        return PTL_OK;
 }
 
 //
index 33a6251..2eba485 100644 (file)
@@ -30,6 +30,8 @@
 #define LL_IOC_CLRFLAGS                 _IOW ('f', 153, long)
 #define LL_IOC_LOV_SETSTRIPE            _IOW ('f', 154, long)
 #define LL_IOC_LOV_GETSTRIPE            _IOW ('f', 155, long)
+#define LL_IOC_LOV_SETEA                _IOW ('f', 156, long)
+#define LL_IOC_RECREATE_OBJ             _IOW ('f', 157, long)
 
 #define O_LOV_DELAY_CREATE 0100000000  /* hopefully this does not conflict */
 
@@ -42,6 +44,7 @@
 #define LOV_PATTERN_RAID1 0x002
 #define LOV_PATTERN_FIRST 0x100
 
+#define lov_user_ost_data lov_user_ost_data_v1
 struct lov_user_ost_data_v1 {     /* per-stripe data structure */
         __u64 l_object_id;       /* OST object ID */
         __u64 l_object_gr;        /* OST object group (creating MDS number) */
index 05fcf61..818596c 100644 (file)
@@ -1,7 +1,7 @@
 Index: linux-2.4.20/fs/ext3/xattr.c
 ===================================================================
---- linux-2.4.20.orig/fs/ext3/xattr.c  2003-11-13 17:14:52.000000000 +0300
-+++ linux-2.4.20/fs/ext3/xattr.c       2003-11-21 16:43:48.000000000 +0300
+--- linux-2.4.20.orig/fs/ext3/xattr.c  2003-11-13 10:59:33.000000000 +0800
++++ linux-2.4.20/fs/ext3/xattr.c       2003-11-25 21:16:51.000000000 +0800
 @@ -1293,9 +1293,10 @@
                                goto cleanup;
                        memcpy(header, HDR(bh), bh->b_size);
index c971a83..8215730 100644 (file)
@@ -14,7 +14,7 @@
  
  sb=n                          Use alternate superblock at this location.
  
-+iopen                         Makes an invisible pseudo-directory called 
++iopen                         Makes an invisible pseudo-directory called
 +                              __iopen__ available in the root directory
 +                              of the filesystem.  Allows open-by-inode-
 +                              number.  i.e., inode 3145 can be accessed
        
 +      if (ext3_iopen_get_inode(inode))
 +              return;
-+      
++
        if(ext3_get_inode_loc(inode, &iloc))
                goto bad_inode;
        bh = iloc.bh;
 --- /dev/null  2003-01-30 03:24:37.000000000 -0700
 +++ linux-2.4.18-p4smp-braam/fs/ext3/iopen.c   2003-07-09 17:13:02.000000000 -0600
-@@ -0,0 +1,259 @@
+@@ -0,0 +1,258 @@
 +/*
 + * linux/fs/ext3/iopen.c
 + *
 + * Special support for open by inode number
 + *
 + * Copyright (C) 2001 by Theodore Ts'o (tytso@alum.mit.edu).
-+ * 
++ *
 + * This file may be redistributed under the terms of the GNU General
 + * Public License.
 + *
 +      struct list_head *lp;
 +      struct dentry *alternate;
 +      char buf[IOPEN_NAME_LEN];
-+      
++
 +      if (dentry->d_name.len >= IOPEN_NAME_LEN)
 +              return ERR_PTR(-ENAMETOOLONG);
 +
 +              return ERR_PTR(-ENOENT);
 +      }
 +
++      assert(list_empty(&dentry->d_alias));           /* d_instantiate */
++      assert(list_empty(&dentry->d_hash));            /* d_rehash */
++
 +      /* preferrably return a connected dentry */
 +      spin_lock(&dcache_lock);
 +      list_for_each(lp, &inode->i_dentry) {
 +      }
 +
 +      if (!list_empty(&inode->i_dentry)) {
-+              alternate = list_entry(inode->i_dentry.next, 
++              alternate = list_entry(inode->i_dentry.next,
 +                                     struct dentry, d_alias);
 +              dget_locked(alternate);
 +              alternate->d_vfs_flags |= DCACHE_REFERENCED;
 +              return alternate;
 +      }
 +      dentry->d_flags |= DCACHE_NFSD_DISCONNECTED;
++
++      /* d_add(), but don't drop dcache_lock before adding dentry to inode */
++      list_add(&dentry->d_alias, &inode->i_dentry);   /* d_instantiate */
++      dentry->d_inode = inode;
++
++      __d_rehash(dentry, 0);                          /* d_rehash */
 +      spin_unlock(&dcache_lock);
 +
-+      d_add(dentry, inode);
 +      return NULL;
 +}
 +
 +{
 +      const unsigned char *old_name, *new_name;
 +
-+      memcpy(dentry->d_iname, target->d_iname, DNAME_INLINE_LEN); 
++      memcpy(dentry->d_iname, target->d_iname, DNAME_INLINE_LEN);
 +      old_name = target->d_name.name;
 +      new_name = dentry->d_name.name;
 +      if (old_name == target->d_iname)
 +
 +/* This function is spliced into ext3_lookup and does the move of a
 + * disconnected dentry (if it exists) to a connected dentry.
++ * Caller must hold dcache_lock.
 + */
 +struct dentry *iopen_connect_dentry(struct dentry *de, struct inode *inode)
 +{
 +      struct list_head *lp;
 +
 +      /* preferrably return a connected dentry */
-+      spin_lock(&dcache_lock);
-+      /* verify this dentry is really new */
-+      assert(!de->d_inode);
-+      assert(list_empty(&de->d_subdirs));
-+      assert(list_empty(&de->d_alias));
-+
-+
 +      list_for_each(lp, &inode->i_dentry) {
 +              tmp = list_entry(lp, struct dentry, d_alias);
 +              if (tmp->d_flags & DCACHE_NFSD_DISCONNECTED) {
 +              }
 +      }
 +
-+      if (!goal) { 
-+              spin_unlock(&dcache_lock);
-+              return NULL; 
-+      }
++      if (!goal)
++              return NULL;
 +
 +      /* Move the goal to the de hash queue - like d_move() */
 +      goal->d_flags &= ~DCACHE_NFSD_DISCONNECTED;
-+      list_del(&goal->d_hash);
-+      list_add(&goal->d_hash, &de->d_hash);
++      list_del_init(&goal->d_hash);
 +
 +      list_del(&goal->d_child);
 +      list_del(&de->d_child);
 +      /* And add them back to the (new) parent lists */
 +      list_add(&goal->d_child, &goal->d_parent->d_subdirs);
 +      list_add(&de->d_child, &de->d_parent->d_subdirs);
-+      spin_unlock(&dcache_lock);
++      __d_rehash(goal, 0);
 +
 +      return goal;
 +}
 +
 +      inode = iget(dir->i_sb, EXT3_BAD_INO);
 +
-+      if (!inode) 
++      if (!inode)
 +              return 0;
 +      d_add(dentry, inode);
 +      return 1;
 +      inode->u.ext3_i.i_dtime = 0;
 +      inode->i_blksize = PAGE_SIZE;   /* This is the optimal IO size
 +                                       * (for stat), not the fs block
-+                                       * size */  
++                                       * size */
 +      inode->i_blocks = 0;
 +      inode->i_version = 1;
 +      inode->i_generation = 0;
 +}
 --- /dev/null  2003-01-30 03:24:37.000000000 -0700
 +++ linux-2.4.18-p4smp-braam/fs/ext3/iopen.h   2003-07-09 17:13:02.000000000 -0600
-@@ -0,0 +1,13 @@
+@@ -0,0 +1,15 @@
 +/*
 + * iopen.h
 + *
 + * Special support for opening files by inode number.
-+ * 
++ *
 + * Copyright (C) 2001 by Theodore Ts'o (tytso@alum.mit.edu).
-+ * 
++ *
 + * This file may be redistributed under the terms of the GNU General
 + * Public License.
 + */
 +
 +extern int ext3_check_for_iopen(struct inode *dir, struct dentry *dentry);
 +extern int ext3_iopen_get_inode(struct inode *inode);
++extern struct dentry *iopen_connect_dentry(struct dentry *de,
++                                         struct inode *inode);
 --- linux-2.4.18-p4smp/fs/ext3/namei.c~iopen-2.4.18    2003-07-09 13:32:38.000000000 -0600
 +++ linux-2.4.18-p4smp-braam/fs/ext3/namei.c   2003-07-09 17:13:02.000000000 -0600
 @@ -34,6 +34,7 @@
  
  /*
   * define how far ahead to read directories while searching them.
-@@ -703,16 +704,21 @@ cleanup_and_exit:
-       return NULL;
- }
- #endif
-+struct dentry *iopen_connect_dentry(struct dentry *de, struct inode *inode);
- static struct dentry *ext3_lookup(struct inode * dir, struct dentry *dentry)
- {
+@@ -709,10 +710,14 @@ cleanup_and_exit:
        struct inode * inode;
        struct ext3_dir_entry_2 * de;
        struct buffer_head * bh;
        bh = ext3_find_entry(dentry, &de);
        inode = NULL;
        if (bh) {
-@@ -723,6 +729,12 @@ static struct dentry *ext3_lookup(struct
+@@ -723,7 +729,28 @@ static struct dentry *ext3_lookup(struct
                if (!inode)
                        return ERR_PTR(-EACCES);
        }
+-      d_add(dentry, inode);
++
++      /* verify this dentry is really new */
++      assert(!dentry->d_inode);
++      assert(list_empty(&dentry->d_alias));           /* d_instantiate */
++      assert(list_empty(&dentry->d_hash));            /* d_rehash */
++      assert(list_empty(&dentry->d_subdirs));
 +
++      spin_lock(&dcache_lock);
 +      if (inode && (alternate = iopen_connect_dentry(dentry, inode))) {
++              spin_unlock(&dcache_lock);
 +              iput(inode);
 +              return alternate;
 +      }
 +
-       d_add(dentry, inode);
++      /* d_add(), but don't drop dcache_lock before adding dentry to inode */
++      if (inode)                                      /* d_instantiate */
++              list_add(&dentry->d_alias, &inode->i_dentry);
++      dentry->d_inode = inode;
++
++      __d_rehash(dentry, 0);                          /* d_rehash */
++      spin_unlock(&dcache_lock);
++
        return NULL;
  }
 --- linux-2.4.18-p4smp/fs/ext3/super.c~iopen-2.4.18    2003-07-09 13:32:38.000000000 -0600
 +++ linux-2.4.18-p4smp-braam/fs/ext3/super.c   2003-07-09 17:13:02.000000000 -0600
-@@ -831,6 +831,17 @@ static int parse_options (char * options
+@@ -831,6 +831,18 @@ static int parse_options (char * options
                         || !strcmp (this_char, "quota")
                         || !strcmp (this_char, "usrquota"))
                        /* Don't do anything ;-) */ ;
 +              else if (!strcmp (this_char, "iopen")) {
 +                      set_opt (sbi->s_mount_opt, IOPEN);
 +                      clear_opt (sbi->s_mount_opt, IOPEN_NOPRIV);
-+              } else if (!strcmp (this_char, "noiopen")) {
++              }
++              else if (!strcmp (this_char, "noiopen")) {
 +                      clear_opt (sbi->s_mount_opt, IOPEN);
 +                      clear_opt (sbi->s_mount_opt, IOPEN_NOPRIV);
 +              }
index ab267bb..ad213c9 100644 (file)
@@ -16,7 +16,7 @@ Index: linux-2.4.19.SuSE/Documentation/filesystems/ext2.txt
  
  sb=n                          Use alternate superblock at this location.
  
-+iopen                         Makes an invisible pseudo-directory called 
++iopen                         Makes an invisible pseudo-directory called
 +                              __iopen__ available in the root directory
 +                              of the filesystem.  Allows open-by-inode-
 +                              number.  i.e., inode 3145 can be accessed
@@ -66,7 +66,7 @@ Index: linux-2.4.19.SuSE/fs/ext3/inode.c
        
 +      if (ext3_iopen_get_inode(inode))
 +              return;
-+      
++
        if(ext3_get_inode_loc(inode, &iloc))
                goto bad_inode;
        bh = iloc.bh;
@@ -74,17 +74,17 @@ Index: linux-2.4.19.SuSE/fs/ext3/iopen.c
 ===================================================================
 --- linux-2.4.19.SuSE.orig/fs/ext3/iopen.c     Sun Nov 16 01:27:31 2003
 +++ linux-2.4.19.SuSE/fs/ext3/iopen.c  Sun Nov 16 01:27:31 2003
-@@ -0,0 +1,259 @@
+@@ -0,0 +1,258 @@
 +/*
 + * linux/fs/ext3/iopen.c
 + *
 + * Special support for open by inode number
 + *
 + * Copyright (C) 2001 by Theodore Ts'o (tytso@alum.mit.edu).
-+ * 
++ *
 + * This file may be redistributed under the terms of the GNU General
 + * Public License.
-+ * 
++ *
 + *
 + * Invariants:
 + *   - there is only ever a single DCACHE_NFSD_DISCONNECTED dentry alias
@@ -130,7 +130,7 @@ Index: linux-2.4.19.SuSE/fs/ext3/iopen.c
 +      struct list_head *lp;
 +      struct dentry *alternate;
 +      char buf[IOPEN_NAME_LEN];
-+      
++
 +      if (dentry->d_name.len >= IOPEN_NAME_LEN)
 +              return ERR_PTR(-ENAMETOOLONG);
 +
@@ -159,6 +159,9 @@ Index: linux-2.4.19.SuSE/fs/ext3/iopen.c
 +              return ERR_PTR(-ENOENT);
 +      }
 +
++      assert(list_empty(&dentry->d_alias));           /* d_instantiate */
++      assert(list_empty(&dentry->d_hash));            /* d_rehash */
++
 +      /* preferrably return a connected dentry */
 +      spin_lock(&dcache_lock);
 +      list_for_each(lp, &inode->i_dentry) {
@@ -167,7 +170,7 @@ Index: linux-2.4.19.SuSE/fs/ext3/iopen.c
 +      }
 +
 +      if (!list_empty(&inode->i_dentry)) {
-+              alternate = list_entry(inode->i_dentry.next, 
++              alternate = list_entry(inode->i_dentry.next,
 +                                     struct dentry, d_alias);
 +              dget_locked(alternate);
 +              alternate->d_vfs_flags |= DCACHE_REFERENCED;
@@ -176,9 +179,14 @@ Index: linux-2.4.19.SuSE/fs/ext3/iopen.c
 +              return alternate;
 +      }
 +      dentry->d_flags |= DCACHE_NFSD_DISCONNECTED;
++
++      /* d_add(), but don't drop dcache_lock before adding dentry to inode */
++      list_add(&dentry->d_alias, &inode->i_dentry);   /* d_instantiate */
++      dentry->d_inode = inode;
++
++      __d_rehash(dentry, 0);                          /* d_rehash */
 +      spin_unlock(&dcache_lock);
 +
-+      d_add(dentry, inode);
 +      return NULL;
 +}
 +
@@ -190,7 +198,7 @@ Index: linux-2.4.19.SuSE/fs/ext3/iopen.c
 +{
 +      const unsigned char *old_name, *new_name;
 +
-+      memcpy(dentry->d_iname, target->d_iname, DNAME_INLINE_LEN); 
++      memcpy(dentry->d_iname, target->d_iname, DNAME_INLINE_LEN);
 +      old_name = target->d_name.name;
 +      new_name = dentry->d_name.name;
 +      if (old_name == target->d_iname)
@@ -203,6 +211,7 @@ Index: linux-2.4.19.SuSE/fs/ext3/iopen.c
 +
 +/* This function is spliced into ext3_lookup and does the move of a
 + * disconnected dentry (if it exists) to a connected dentry.
++ * Caller must hold dcache_lock.
 + */
 +struct dentry *iopen_connect_dentry(struct dentry *de, struct inode *inode)
 +{
@@ -210,13 +219,6 @@ Index: linux-2.4.19.SuSE/fs/ext3/iopen.c
 +      struct list_head *lp;
 +
 +      /* preferrably return a connected dentry */
-+      spin_lock(&dcache_lock);
-+      /* verify this dentry is really new */
-+      assert(!de->d_inode);
-+      assert(list_empty(&de->d_subdirs));
-+      assert(list_empty(&de->d_alias));
-+
-+
 +      list_for_each(lp, &inode->i_dentry) {
 +              tmp = list_entry(lp, struct dentry, d_alias);
 +              if (tmp->d_flags & DCACHE_NFSD_DISCONNECTED) {
@@ -228,10 +230,8 @@ Index: linux-2.4.19.SuSE/fs/ext3/iopen.c
 +              }
 +      }
 +
-+      if (!goal) { 
-+              spin_unlock(&dcache_lock);
-+              return NULL; 
-+      }
++      if (!goal)
++              return NULL;
 +
 +      /* Move the goal to the de hash queue - like d_move() */
 +      goal->d_flags &= ~DCACHE_NFSD_DISCONNECTED;
@@ -250,7 +250,6 @@ Index: linux-2.4.19.SuSE/fs/ext3/iopen.c
 +      list_add(&goal->d_child, &goal->d_parent->d_subdirs);
 +      list_add(&de->d_child, &de->d_parent->d_subdirs);
 +      __d_rehash(goal, 0);
-+      spin_unlock(&dcache_lock);
 +
 +      return goal;
 +}
@@ -294,7 +293,7 @@ Index: linux-2.4.19.SuSE/fs/ext3/iopen.c
 +
 +      inode = iget(dir->i_sb, EXT3_BAD_INO);
 +
-+      if (!inode) 
++      if (!inode)
 +              return 0;
 +      d_add(dentry, inode);
 +      return 1;
@@ -323,7 +322,7 @@ Index: linux-2.4.19.SuSE/fs/ext3/iopen.c
 +      inode->u.ext3_i.i_dtime = 0;
 +      inode->i_blksize = PAGE_SIZE;   /* This is the optimal IO size
 +                                       * (for stat), not the fs block
-+                                       * size */  
++                                       * size */
 +      inode->i_blocks = 0;
 +      inode->i_version = 1;
 +      inode->i_generation = 0;
@@ -338,20 +337,22 @@ Index: linux-2.4.19.SuSE/fs/ext3/iopen.h
 ===================================================================
 --- linux-2.4.19.SuSE.orig/fs/ext3/iopen.h     Sun Nov 16 01:27:31 2003
 +++ linux-2.4.19.SuSE/fs/ext3/iopen.h  Sun Nov 16 01:27:31 2003
-@@ -0,0 +1,13 @@
+@@ -0,0 +1,15 @@
 +/*
 + * iopen.h
 + *
 + * Special support for opening files by inode number.
-+ * 
++ *
 + * Copyright (C) 2001 by Theodore Ts'o (tytso@alum.mit.edu).
-+ * 
++ *
 + * This file may be redistributed under the terms of the GNU General
 + * Public License.
 + */
 +
 +extern int ext3_check_for_iopen(struct inode *dir, struct dentry *dentry);
 +extern int ext3_iopen_get_inode(struct inode *inode);
++extern struct dentry *iopen_connect_dentry(struct dentry *de,
++                                         struct inode *inode);
 Index: linux-2.4.19.SuSE/fs/ext3/namei.c
 ===================================================================
 --- linux-2.4.19.SuSE.orig/fs/ext3/namei.c     Sun Nov 16 01:23:20 2003
@@ -365,14 +366,7 @@ Index: linux-2.4.19.SuSE/fs/ext3/namei.c
  
  /*
   * define how far ahead to read directories while searching them.
-@@ -922,16 +922,21 @@
-       return NULL;
- }
- #endif
-+struct dentry *iopen_connect_dentry(struct dentry *de, struct inode *inode);
- static struct dentry *ext3_lookup(struct inode * dir, struct dentry *dentry)
- {
+@@ -922,10 +922,14 @@
        struct inode * inode;
        struct ext3_dir_entry_2 * de;
        struct buffer_head * bh;
@@ -387,31 +381,49 @@ Index: linux-2.4.19.SuSE/fs/ext3/namei.c
        bh = ext3_find_entry(dentry, &de);
        inode = NULL;
        if (bh) {
-@@ -943,6 +948,12 @@
+@@ -943,7 +948,28 @@
                        return ERR_PTR(-EACCES);
                }
        }
+-      d_add(dentry, inode);
++
++      /* verify this dentry is really new */
++      assert(!dentry->d_inode);
++      assert(list_empty(&dentry->d_alias));           /* d_instantiate */
++      assert(list_empty(&dentry->d_hash));            /* d_rehash */
++      assert(list_empty(&dentry->d_subdirs));
 +
++      spin_lock(&dcache_lock);
 +      if (inode && (alternate = iopen_connect_dentry(dentry, inode))) {
++              spin_unlock(&dcache_lock);
 +              iput(inode);
 +              return alternate;
 +      }
 +
-       d_add(dentry, inode);
++      /* d_add(), but don't drop dcache_lock before adding dentry to inode */
++      if (inode)                                      /* d_instantiate */
++              list_add(&dentry->d_alias, &inode->i_dentry);
++      dentry->d_inode = inode;
++
++      __d_rehash(dentry, 0);                          /* d_rehash */
++      spin_unlock(&dcache_lock);
++
        return NULL;
  }
 Index: linux-2.4.19.SuSE/fs/ext3/super.c
 ===================================================================
 --- linux-2.4.19.SuSE.orig/fs/ext3/super.c     Sun Nov 16 01:19:22 2003
 +++ linux-2.4.19.SuSE/fs/ext3/super.c  Sun Nov 16 01:27:31 2003
-@@ -864,6 +864,17 @@
+@@ -864,6 +864,18 @@
                         || !strcmp (this_char, "quota")
                         || !strcmp (this_char, "usrquota"))
                        /* Don't do anything ;-) */ ;
 +              else if (!strcmp (this_char, "iopen")) {
 +                      set_opt (sbi->s_mount_opt, IOPEN);
 +                      clear_opt (sbi->s_mount_opt, IOPEN_NOPRIV);
-+              } else if (!strcmp (this_char, "noiopen")) {
++              }
++              else if (!strcmp (this_char, "noiopen")) {
 +                      clear_opt (sbi->s_mount_opt, IOPEN);
 +                      clear_opt (sbi->s_mount_opt, IOPEN_NOPRIV);
 +              }
index 98fd550..5fbd0fc 100644 (file)
@@ -453,11 +453,11 @@ Index: linux-2.4.19-pre1/fs/namei.c
 +                                                &dentry->d_name, 0, NULL);
 +                              d_invalidate(dentry);
 +                              dput(dentry);
-+                                if (IS_ERR(new)) { 
-+                                        err = PTR_ERR(new);
-+                                        break;
-+                                }
-+                                nd->dentry = new;
++                              if (IS_ERR(new)) { 
++                                      err = PTR_ERR(new);
++                                      break;
++                              }
++                              nd->dentry = new;
 +                      }
 +              } else
 +              if (dentry && dentry->d_op && dentry->d_op->d_revalidate) {
@@ -1406,8 +1406,8 @@ Index: linux-2.4.19-pre1/fs/stat.c
  {
        struct inode * inode = dentry->d_inode;
 -      if (inode->i_op && inode->i_op->revalidate)
-+        if (!inode)
-+                return -ENOENT;
++      if (!inode)
++              return -ENOENT;
 +      if (inode->i_op && inode->i_op->revalidate_it)
 +              return inode->i_op->revalidate_it(dentry, it);
 +      else if (inode->i_op && inode->i_op->revalidate)
index b49babd..6b6027a 100644 (file)
@@ -436,11 +436,11 @@ Index: linux-2.4.19.SuSE/fs/namei.c
 +                                                &dentry->d_name, 0, NULL);
 +                              d_invalidate(dentry);
 +                              dput(dentry);
-+                                if (IS_ERR(new)) { 
-+                                        err = PTR_ERR(new);
-+                                        break;
-+                                }
-+                                nd->dentry = new;
++                              if (IS_ERR(new)) { 
++                                      err = PTR_ERR(new);
++                                      break;
++                              }
++                              nd->dentry = new;
 +                      }
 +              } else
                if (dentry && dentry->d_op && dentry->d_op->d_revalidate) {
@@ -1386,8 +1386,8 @@ Index: linux-2.4.19.SuSE/fs/stat.c
  {
        struct inode * inode = dentry->d_inode;
 -      if (inode->i_op && inode->i_op->revalidate)
-+        if (!inode)
-+                return -ENOENT;
++      if (!inode)
++              return -ENOENT;
 +      if (inode->i_op && inode->i_op->revalidate_it)
 +              return inode->i_op->revalidate_it(dentry, it);
 +      else if (inode->i_op && inode->i_op->revalidate)
index ace8619..ff5ef61 100644 (file)
  {
        struct inode * inode = dentry->d_inode;
 -      if (inode->i_op && inode->i_op->revalidate)
-+        if (!inode)
-+                return -ENOENT;
++      if (!inode)
++              return -ENOENT;
 +      if (inode->i_op && inode->i_op->revalidate_it)
 +              return inode->i_op->revalidate_it(dentry, it);
 +      else if (inode->i_op && inode->i_op->revalidate)
index 5dd86e0..6742227 100644 (file)
@@ -89,10 +89,10 @@ Index: linux-2.6.0-test6/fs/namei.c
  {
        struct dentry * result;
        struct inode *dir = parent->d_inode;
-+        int counter = 0;
++      int counter = 0;
  
 +again:
-+        counter++;
++      counter++;
        down(&dir->i_sem);
        /*
         * First re-do the cached lookup just in case it was created
@@ -101,10 +101,10 @@ Index: linux-2.6.0-test6/fs/namei.c
                if (!result->d_op->d_revalidate(result, nd) && !d_invalidate(result)) {
                        dput(result);
 -                      result = ERR_PTR(-ENOENT);
-+                        if (counter > 10)
-+                                result = ERR_PTR(-ESTALE);
-+                        if (!IS_ERR(result))
-+                                goto again;
++                      if (counter > 10)
++                              result = ERR_PTR(-ESTALE);
++                      if (!IS_ERR(result))
++                              goto again;
                }
        }
        return result;
index 51e4937..41437b8 100644 (file)
@@ -34,3 +34,4 @@ jbd-get_write_access.patch
 nfs_export_kernel-2.4.20-hp.patch
 ext3-ea-in-inode-2.4.20.patch
 bproc-patch-2.4.20
+ext3-truncate-buffer-head.patch
index 09b8592..c180a5b 100644 (file)
@@ -32,3 +32,4 @@ ext3-pdirops-2.4.18-chaos.patch
 ext3-extents-2.4.18-chaos-pdirops.patch
 nfs_export_kernel-2.4.18.patch
 ext3-raw-lookup-pdirops.patch
+ext3-truncate-buffer-head.patch
index 4365c39..9905491 100644 (file)
@@ -33,3 +33,4 @@ jbd-get_write_access.patch
 ext3-ea-in-inode-2.4.20.patch 
 listman-2.4.20.patch
 ext3-trusted_ea-2.4.20.patch 
+ext3-truncate-buffer-head.patch
index 52b4b88..f371650 100755 (executable)
@@ -1,4 +1,5 @@
 #!/bin/bash
+#set -xv
 
 #
 # This script is to generate lib lustre library as a whole. It will leave
@@ -8,48 +9,80 @@
 
 AR=/usr/bin/ar
 LD=/usr/bin/ld
+RANLIB=/usr/bin/ranlib
 
 CWD=`pwd`
 
 SYSIO=$1
 
+#if [ ! -f $SYSIO/lib/libsysio.a ]; then
+#  echo "ERROR: $SYSIO/lib/libsysio.a dosen't exist"
+#  exit 1
+#fi
+#
+# do cleanup at first
+#rm -f liblustre.so
+
 ALL_OBJS=
 
 build_obj_list() {
   _objs=`$AR -t $1/$2`
   for _lib in $_objs; do
-  ALL_OBJS=$ALL_OBJS"$1/$_lib ";
+    ALL_OBJS=$ALL_OBJS"$1/$_lib ";
   done;
 }
 
+#
+# special treatment for libsysio
+#
+#sysio_tmp=$CWD/sysio_tmp_`date +%s`
+#build_sysio_obj_list() {
+#  _objs=`$AR -t $1`
+#  mkdir -p $sysio_tmp
+#  $AR -x $1
+#  mv $_objs $sysio_tmp
+#  for _lib in $_objs; do
+#    ALL_OBJS=$ALL_OBJS"$sysio_tmp/$_lib ";
+#  done
+#}
+
 # lustre components libs
 build_obj_list . libllite.a
 build_obj_list ../lov liblov.a
 build_obj_list ../obdecho libobdecho.a
 build_obj_list ../osc libosc.a
 build_obj_list ../mdc libmdc.a
-build_obj_list ../ldlm libldlm.a
 build_obj_list ../ptlrpc libptlrpc.a
 build_obj_list ../obdclass liblustreclass.a
 build_obj_list ../lvfs liblvfs.a
 
 # portals components libs
-build_obj_list ../portals/utils libptlctl.a
+build_obj_list ../portals/utils libuptlctl.a
 build_obj_list ../portals/unals libtcpnal.a
 build_obj_list ../portals/portals libportals.a
 
+# create static lib lsupport
+rm -f $CWD/liblsupport.a
+$AR -cru $CWD/liblsupport.a $ALL_OBJS
+$RANLIB $CWD/liblsupport.a
+
 # libsysio components libs
 build_obj_list $SYSIO/drivers/native libsysio_native.a
 build_obj_list $SYSIO/drivers/sockets libsysio_sockets.a
 build_obj_list $SYSIO/src libsysio.a
 build_obj_list $SYSIO/dev/stdfd libsysio_stdfd.a
+#
+#build_sysio_obj_list $SYSIO/lib/libsysio.a
+#
 
-
-# create static lib
+# create static lib lustre
 rm -f $CWD/liblustre.a
-$AR -r $CWD/liblustre.a $ALL_OBJS
+$AR -cru $CWD/liblustre.a $ALL_OBJS
+$RANLIB $CWD/liblustre.a
 
-# create shared lib
+# create shared lib lustre
 rm -f $CWD/liblustre.so
 $LD -shared -o $CWD/liblustre.so -init __liblustre_setup_ -fini __liblustre_cleanup_ \
        $ALL_OBJS -lpthread
+
+#rm -rf $sysio_tmp
index 8cfcf0d..1c00634 100644 (file)
 #include <inode.h>
 #include <file.h>
 
+#undef LIST_HEAD
+
 #include "llite_lib.h"
 
-static void ll_intent_release(struct lookup_intent *it)
+static void ll_intent_drop_lock(struct lookup_intent *it)
 {
         struct lustre_handle *handle;
-        ENTRY;
 
-        /* LASSERT(ll_d2d(de) != NULL); */
-
-        if (it->d.lustre.it_lock_mode) {
+        if (it->it_op && it->d.lustre.it_lock_mode) {
                 handle = (struct lustre_handle *)&it->d.lustre.it_lock_handle;
                 CDEBUG(D_DLMTRACE, "releasing lock with cookie "LPX64
-                       " from it %p\n",
-                       handle->cookie, it);
+                       " from it %p\n", handle->cookie, it);
                 ldlm_lock_decref(handle, it->d.lustre.it_lock_mode);
 
-                /* intent_release may be called multiple times, from
-                   this thread and we don't want to double-decref this
-                   lock (see bug 494) */
+                /* bug 494: intent_release may be called multiple times, from
+                 * this thread and we don't want to double-decref this lock */
                 it->d.lustre.it_lock_mode = 0;
         }
-        it->it_magic = 0;
-        it->it_op_release = 0;
-        EXIT;
 }
 
-#if 0
-static void llu_mdc_lock_set_inode(struct lustre_handle *lockh,
-                                   struct inode *inode)
+static void ll_intent_release(struct lookup_intent *it)
 {
-        struct ldlm_lock *lock = ldlm_handle2lock(lockh);
         ENTRY;
 
-        LASSERT(lock != NULL);
-        lock->l_data = inode;
-        LDLM_LOCK_PUT(lock);
+        ll_intent_drop_lock(it);
+        it->it_magic = 0;
+        it->it_op_release = 0;
+        it->d.lustre.it_disposition = 0;
+        it->d.lustre.it_data = NULL;
         EXIT;
 }
 
-static int pnode_revalidate_finish(struct ptlrpc_request *request,
-                                   struct inode *parent, struct pnode *pnode,
-                                   struct lookup_intent *it, int offset,
-                                   obd_id ino)
-{
-        struct llu_sb_info    *sbi = llu_i2sbi(parent);
-        struct pnode_base     *pb = pnode->p_base;
-        struct mds_body       *body;
-        struct lov_stripe_md  *lsm = NULL;
-        struct lov_mds_md     *lmm;
-        int                    lmmsize;
-        int                    rc = 0;
-        ENTRY;
-
-        /* NB 1 request reference will be taken away by ll_intent_lock()
-         * when I return */
-
-        if (it_disposition(it, DISP_LOOKUP_NEG))
-                RETURN(-ENOENT);
-
-        /* We only get called if the mdc_enqueue() called from
-         * ll_intent_lock() was successful.  Therefore the mds_body is
-         * present and correct, and the eadata is present (but still
-         * opaque, so only obd_unpackmd() can check the size) */
-        body = lustre_msg_buf(request->rq_repmsg, offset, sizeof (*body));
-        LASSERT (body != NULL);
-        LASSERT_REPSWABBED (request, offset);
-
-        if (body->valid & OBD_MD_FLEASIZE) {
-                /* Only bother with this if inodes's LSM not set? */
-
-                if (body->eadatasize == 0) {
-                        CERROR ("OBD_MD_FLEASIZE set, but eadatasize 0\n");
-                        GOTO (out, rc = -EPROTO);
-                }
-                lmmsize = body->eadatasize;
-                lmm = lustre_msg_buf (request->rq_repmsg, offset + 1, lmmsize);
-                LASSERT (lmm != NULL);
-                LASSERT_REPSWABBED (request, offset + 1);
-
-                rc = obd_unpackmd (&sbi->ll_osc_conn,
-                                   &lsm, lmm, lmmsize);
-                if (rc < 0) {
-                        CERROR ("Error %d unpacking eadata\n", rc);
-                        LBUG();
-                        /* XXX don't know if I should do this... */
-                        GOTO (out, rc);
-                        /* or skip the ll_update_inode but still do
-                         * mdc_lock_set_inode() */
-                }
-                LASSERT (rc >= sizeof (*lsm));
-                rc = 0;
-        }
-
-        llu_update_inode(pb->pb_ino, body, lsm);
-
-        if (lsm != NULL &&
-            llu_i2info(pb->pb_ino)->lli_smd != lsm)
-                obd_free_memmd (&sbi->ll_osc_conn, &lsm);
-
-        llu_mdc_lock_set_inode((struct lustre_handle *)&it->d.lustre.it_lock_handle,
-                               pb->pb_ino);
- out:
-        RETURN(rc);
-}
-#endif
-
 /*
  * remove the stale inode from pnode
  */
@@ -156,11 +82,11 @@ void unhook_stale_inode(struct pnode *pno)
         LASSERT(llu_i2info(inode)->lli_stale_flag);
 
         pno->p_base->pb_ino = NULL;
+        I_RELE(inode);
 
         if (!llu_i2info(inode)->lli_open_count) {
                 CDEBUG(D_INODE, "unhook inode %p (ino %lu) from pno %p\n",
                                 inode, llu_i2info(inode)->lli_st_ino, pno);
-                I_RELE(inode);
                 if (!inode->i_ref)
                         _sysio_i_gone(inode);
         }
@@ -188,14 +114,14 @@ void llu_lookup_finish_locks(struct lookup_intent *it, struct pnode *pnode)
 
 }
 
-static inline void ll_invalidate_inode_pages(struct inode * inode)
+static inline void llu_invalidate_inode_pages(struct inode * inode)
 {
         /* do nothing */
 }
 
-static int llu_mdc_blocking_ast(struct ldlm_lock *lock,
-                                struct ldlm_lock_desc *desc,
-                                void *data, int flag)
+int llu_mdc_blocking_ast(struct ldlm_lock *lock,
+                         struct ldlm_lock_desc *desc,
+                         void *data, int flag)
 {
         int rc;
         struct lustre_handle lockh;
@@ -232,7 +158,7 @@ static int llu_mdc_blocking_ast(struct ldlm_lock *lock,
                         CDEBUG(D_INODE, "invalidating inode %lu\n",
                                lli->lli_st_ino);
 
-                        ll_invalidate_inode_pages(inode);
+                        llu_invalidate_inode_pages(inode);
                 }
 
 /*
@@ -250,6 +176,33 @@ static int llu_mdc_blocking_ast(struct ldlm_lock *lock,
         RETURN(0);
 }
 
+static int pnode_revalidate_finish(struct ptlrpc_request *req,
+                                   int offset,
+                                   struct lookup_intent *it,
+                                   struct pnode *pnode)
+{
+        struct inode *inode = pnode->p_base->pb_ino;
+        struct lustre_md md;
+        int rc = 0;
+        ENTRY;
+
+        LASSERT(inode);
+
+        if (!req)
+                RETURN(0);
+
+        if (it_disposition(it, DISP_LOOKUP_NEG))
+                RETURN(-ENOENT);
+
+        rc = mdc_req2lustre_md(req, offset, llu_i2sbi(inode)->ll_osc_exp, &md);
+        if (rc)
+                RETURN(rc);
+
+        llu_update_inode(inode, md.body, md.lsm);
+
+        RETURN(rc);
+}
+
 int llu_pb_revalidate(struct pnode *pnode, int flags, struct lookup_intent *it)
 {
         struct pnode_base *pb = pnode->p_base;
@@ -285,7 +238,7 @@ int llu_pb_revalidate(struct pnode *pnode, int flags, struct lookup_intent *it)
         }
 
         /* This is due to bad interaction with libsysio. remove this when we
-         * switched to libbsdio
+         * switched to libbsdio XXX
          */
         {
                 struct llu_inode_info *lli = llu_i2info(pb->pb_ino);
@@ -322,14 +275,13 @@ int llu_pb_revalidate(struct pnode *pnode, int flags, struct lookup_intent *it)
         if (req == NULL && rc >= 0)
                 GOTO(out, rc);
 
-        /* unfortunately ll_intent_lock may cause a callback and revoke our
-           dentry */
-        /*
-        spin_lock(&dcache_lock);
-        list_del_init(&de->d_hash);
-        spin_unlock(&dcache_lock);
-        d_rehash(de);
-        */
+        if (rc < 0)
+                GOTO(out, rc = 0);
+
+        rc = pnode_revalidate_finish(req, 1, it, pnode);
+
+        /* Note: ll_intent_lock may cause a callback, check this! */
+
         if (it->it_op & (IT_OPEN | IT_GETATTR))
                 LL_SAVE_INTENT(pb->pb_ino, it);
         RETURN(1);
@@ -339,7 +291,7 @@ int llu_pb_revalidate(struct pnode *pnode, int flags, struct lookup_intent *it)
         if (rc == 0) {
                 LASSERT(pb->pb_ino);
                 if (S_ISDIR(llu_i2info(pb->pb_ino)->lli_st_mode))
-                        ll_invalidate_inode_pages(pb->pb_ino);
+                        llu_invalidate_inode_pages(pb->pb_ino);
                 llu_i2info(pb->pb_ino)->lli_stale_flag = 1;
                 unhook_stale_inode(pnode);
         } else {
@@ -362,8 +314,9 @@ static int lookup_it_finish(struct ptlrpc_request *request, int offset,
         int rc;
 
         /* NB 1 request reference will be taken away by ll_intent_lock()
-         * when I return */
-        /* XXX libsysio require the inode must be generated here XXX */
+         * when I return 
+         * Note: libsysio require the inode must be generated here
+         */
         if ((it->it_op & IT_CREAT) || !it_disposition(it, DISP_LOOKUP_NEG)) {
                 struct lustre_md md;
                 struct llu_inode_info *lli;
@@ -411,15 +364,10 @@ static int lookup_it_finish(struct ptlrpc_request *request, int offset,
                 ENTRY;
         }
 
+        /* intent will be further used in cases of open()/getattr() */
         if (inode && (it->it_op & (IT_OPEN | IT_GETATTR)))
                 LL_SAVE_INTENT(inode, it);
-/*
-        dentry->d_op = &ll_d_ops;
-        ll_set_dd(dentry);
 
-        if (dentry == saved)
-                d_add(dentry, inode);
-*/
         child->p_base->pb_ino = inode;
 
         RETURN(0);
@@ -440,9 +388,6 @@ struct inode *llu_inode_from_lock(struct ldlm_lock *lock)
         return inode;
 }
 
-/* XXX */
-#define EXT2_NAME_LEN (255)
-
 static int llu_lookup_it(struct inode *parent, struct pnode *pnode,
                          struct lookup_intent *it, int flags)
 {
@@ -457,18 +402,6 @@ static int llu_lookup_it(struct inode *parent, struct pnode *pnode,
         if (pnode->p_base->pb_name.len > EXT2_NAME_LEN)
                 RETURN(-ENAMETOOLONG);
 
-
-/*
-        CDEBUG(D_VFSTRACE, "VFS Op:name=%s,dir=%lu/%u(%p),intent=%s\n",
-               dentry->d_name.name, parent->i_ino, parent->i_generation,
-               parent, LL_IT2STR(it));
-
-        if (d_mountpoint(dentry))
-                CERROR("Tell Peter, lookup on mtpt, it %s\n", LL_IT2STR(it));
-
-        ll_frob_intent(&it, &lookup_it);
-*/
-
         if (!it) {
                 it = &lookup_it;
                 it->it_op_release = ll_intent_release;
@@ -496,12 +429,6 @@ static int llu_lookup_it(struct inode *parent, struct pnode *pnode,
 
         llu_lookup_finish_locks(it, pnode);
 
-/*
-        if (dentry == save)
-                GOTO(out, retval = NULL);
-        else
-                GOTO(out, retval = dentry);
-*/
  out:
         if (req)
                 ptlrpc_req_finished(req);
@@ -556,12 +483,7 @@ translate_lookup_intent(struct intent *intent, const char *path)
                 it->it_flags |= fmode;
         }
 
-        /*
-        else if (intent->int_opmask & INT_CREAT)
-                it->it_op |= IT_LOOKUP;
-         */
-
-        /* FIXME libsysio has strange code on intent handling,
+        /* XXX libsysio has strange code on intent handling,
          * more check later */
         if (it->it_flags & O_CREAT) {
                 it->it_op |= IT_CREAT;
@@ -570,9 +492,8 @@ translate_lookup_intent(struct intent *intent, const char *path)
 
         if (intent->int_opmask & INT_GETATTR)
                 it->it_op |= IT_GETATTR;
-        /* XXX */
-        if (intent->int_opmask & INT_SETATTR)
-                LBUG();
+
+        LASSERT(!(intent->int_opmask & INT_SETATTR));
 
         /* libsysio is different to linux vfs when doing unlink/rmdir,
          * INT_UPDPARENT was passed down during name resolution. Here
diff --git a/lustre/liblustre/recovery_small.c b/lustre/liblustre/recovery_small.c
deleted file mode 100644 (file)
index b1292c2..0000000
+++ /dev/null
@@ -1,375 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- * Lustre Light user test program
- *
- *  Copyright (c) 2002, 2003 Cluster File Systems, Inc.
- *
- *   This file is part of Lustre, http://www.lustre.org.
- *
- *   Lustre is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   Lustre is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with Lustre; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#define _BSD_SOURCE
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <getopt.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/queue.h>
-#include <getopt.h>
-
-#include <sysio.h>
-#include <mount.h>
-
-#include "test_common.h"
-
-static struct {
-        const char   *name;
-        unsigned long code;
-} drop_arr [] =
-{
-        {"MDS_REQUEST", 0x123},
-        {"MDS_REPLY", 0x122},
-        {NULL, 0}
-};
-
-static int drop_index = 0;
-
-static char mds_server[1024] = {0, };
-
-int do_stat(const char *name, struct stat *buf)
-{
-       struct stat stat;
-        int rc;
-
-       rc = lstat(name, &stat);
-        if (rc) {
-               printf("error %d stat %s\n", rc, name);
-               exit(1);
-       }
-        if (buf)
-                memcpy(buf, &stat, sizeof(*buf));
-
-       return 0;
-}
-
-void prepare_reg(const char *path)
-{
-        int fd, rc;
-
-        fd = open(path, O_RDWR|O_CREAT, 00644);
-        if (fd < 0) {
-                printf("error %d create %s\n", fd, path);
-                exit(1);
-        }
-
-        rc = close(fd);
-        if (rc) {
-                printf("error %d close %s\n", rc, path);
-                exit(1);
-        }
-}
-
-void cleanup_reg(const char *path)
-{
-        int rc;
-
-        rc = unlink(path);
-        if (rc) {
-                printf("error %d unlink %s\n", rc, path);
-                exit(1);
-        }
-}
-
-void prepare_dir(const char *path)
-{
-        int rc;
-
-        rc = mkdir(path, 00644);
-        if (rc < 0) {
-                printf("error %d mkdir %s\n", rc, path);
-                exit(1);
-        }
-}
-
-void cleanup_dir(const char *path)
-{
-        int rc;
-
-        rc = rmdir(path);
-        if (rc) {
-                printf("error %d unlink %s\n", rc, path);
-                exit(1);
-        }
-}
-
-#define FAIL()                                                             \
-    do {                                                                   \
-        char cmd[1024];                                                    \
-        int rc;                                                            \
-                                                                           \
-        if (drop_arr[drop_index].name) {                                   \
-            printf("server drops next %s\n", drop_arr[drop_index].name);   \
-            sprintf(cmd,                                                   \
-                    "ssh %s \"echo %lu > /proc/sys/lustre/fail_loc\"",     \
-                    mds_server, drop_arr[drop_index].code);                \
-            if (system(cmd)) {                                             \
-                printf("error excuting remote command: %d\n", rc);         \
-                exit(rc);                                                  \
-            }                                                              \
-        }                                                                  \
-    } while (0)
-
-#define RECOVER()                                                          \
-    do {                                                                   \
-        char cmd[1024];                                                    \
-                                                                           \
-        if (drop_arr[drop_index].name) {                                   \
-            sprintf(cmd, "ssh %s \"echo 0 > /proc/sys/lustre/fail_loc\"",  \
-                    mds_server);                                           \
-            system(cmd);                                                   \
-        }                                                                  \
-    } while (0)
-
-#define ENTRY(str)                                                      \
-        do {                                                            \
-                char buf[100];                                          \
-                int len;                                                \
-                sprintf(buf, "===== START: %s ", (str));                \
-                len = strlen(buf);                                      \
-                if (len < 79) {                                         \
-                        memset(buf+len, '=', 100-len);                  \
-                        buf[79] = '\n';                                 \
-                        buf[80] = 0;                                    \
-                }                                                       \
-                printf("%s", buf);                                      \
-        } while (0)
-
-#define LEAVE()                                                         \
-        do {                                                            \
-                printf("----- END TEST successfully ---");              \
-                printf("-----------------------------");                \
-                printf("-------------------\n");                        \
-        } while (0)
-
-
-void t1()
-{
-        char *path="/mnt/lustre/test_t1";
-        ENTRY("create/delete");
-
-        FAIL();
-        t_touch(path);
-        RECOVER();
-        FAIL();
-        t_unlink(path);
-        RECOVER();
-        LEAVE();
-}
-
-void t2()
-{
-        char *path="/mnt/lustre/test_t2";
-        ENTRY("mkdir/rmdir");
-
-        FAIL();
-        t_mkdir(path);
-        RECOVER();
-        FAIL();
-        t_rmdir(path);
-        RECOVER();
-        LEAVE();
-}
-
-void t3()
-{
-        char *path="/mnt/lustre/test_t3";
-        ENTRY("regular stat");
-
-        t_touch(path);
-        FAIL();
-        t_check_stat(path, NULL);
-        RECOVER();
-        t_unlink(path);
-        LEAVE();
-}
-
-void t4()
-{
-        char *path="/mnt/lustre/test_t4";
-        ENTRY("dir stat");
-
-        t_mkdir(path);
-        FAIL();
-        t_check_stat(path, NULL);
-        RECOVER();
-        t_rmdir(path);
-        LEAVE();
-}
-
-void t5()
-{
-        char *path="/mnt/lustre/test_t5";
-        const int bufsize = 4096;
-       char wbuf[bufsize], rbuf[bufsize];
-        int npages = 100;
-        int fd, rc, i;
-        ENTRY("sequential page aligned file I/O");
-
-        t_touch(path);
-
-       fd = t_open(path);
-
-       for (i = 0; i < npages; i++ ) {
-                memset(wbuf, i, bufsize);
-               rc = write(fd, wbuf, bufsize);
-                if (rc != bufsize) {
-                        printf("write error %d (i = %d)\n", rc, i);
-                        exit(1);
-                }
-       }
-        printf("succefully write %d pages\n", npages);
-
-       lseek(fd, 0, SEEK_SET);
-
-       for (i = 0; i < npages; i++ ) {
-               memset(rbuf, 0, bufsize);
-               rc = read(fd, rbuf, bufsize);
-                if (rc != bufsize) {
-                        printf("read error %d (i = %d)\n", rc, i);
-                        exit(1);
-                }
-       }
-        printf("succefully read & verified %d pages\n", npages);
-
-        t_close(fd);
-
-        t_unlink(path);
-        LEAVE();
-}
-
-void t6()
-{
-        char *path="/mnt/lustre/test_t6";
-        char *path2="/mnt/lustre/test_t6_link";
-        ENTRY("symlink");
-
-        t_touch(path);
-        FAIL();
-        t_symlink(path, path2);
-        RECOVER();
-        t_check_stat(path2, NULL);
-        t_unlink(path2);
-        t_unlink(path);
-        LEAVE();
-}
-
-void t7()
-{
-        char *path="/mnt/lustre/test_t7";
-        ENTRY("mknod");
-
-        FAIL();
-        t_mknod(path, S_IFCHR | 0644, 5, 4);
-        RECOVER();
-        t_check_stat(path, NULL);
-        t_unlink(path);
-        LEAVE();
-}
-
-extern int portal_debug;
-extern int portal_subsystem_debug;
-
-extern void __liblustre_setup_(void);
-extern void __liblustre_cleanup_(void);
-
-void usage(const char *cmd)
-{
-        printf("Usage: \t%s -s mds_hostname --target mdsnid:/mdsname/profile\n", cmd);
-        printf("       \t%s -s mds_hostname --dumpfile dumpfile\n", cmd);
-        exit(-1);
-}
-
-int main(int argc, char * argv[])
-{
-        int opt_index, c;
-        char cmd[1024];
-        static struct option long_opts[] = {
-                {"target", 1, 0, 0},
-                {"dumpfile", 1, 0, 0},
-                {0, 0, 0, 0}
-        };
-
-        if (argc < 3)
-                usage(argv[0]);
-
-        while ((c = getopt_long(argc, argv, "s:", long_opts, &opt_index)) != -1) {
-                switch (c) {
-                case 0: {
-                        if (!optarg[0])
-                                usage(argv[0]);
-
-                        if (!strcmp(long_opts[opt_index].name, "target")) {
-                                setenv(ENV_LUSTRE_MNTTGT, optarg, 1);
-                        } else if (!strcmp(long_opts[opt_index].name, "dumpfile")) {
-                                setenv(ENV_LUSTRE_DUMPFILE, optarg, 1);
-                        } else
-                                usage(argv[0]);
-                        break;
-                }
-                case 's':
-                        strcpy(mds_server, optarg);
-                        break;
-                default:
-                        usage(argv[0]);
-                }
-        }
-
-        if (optind != argc)
-                usage(argv[0]);
-
-        if (strlen(mds_server) == 0)
-                usage(argv[0]);
-
-        sprintf(cmd, "ssh %s cat /dev/null", mds_server);
-        if (system(cmd)) {
-                printf("can't access server node: %s\n", mds_server);
-                exit(-1);
-        }
-
-        __liblustre_setup_();
-
-        while (drop_arr[drop_index].name) {
-                t1();
-                t2();
-                t3();
-                t4();
-                t5();
-                t6();
-                t7();
-
-                drop_index++;
-        }
-
-       printf("liblustre is about shutdown\n");
-        __liblustre_cleanup_();
-
-       printf("complete successfully\n");
-        return (0);
-}
diff --git a/lustre/liblustre/replay_single.c b/lustre/liblustre/replay_single.c
deleted file mode 100755 (executable)
index 1602a7c..0000000
+++ /dev/null
@@ -1,408 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- * Lustre Light user test program
- *
- *  Copyright (c) 2002, 2003 Cluster File Systems, Inc.
- *
- *   This file is part of Lustre, http://www.lustre.org.
- *
- *   Lustre is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   Lustre is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with Lustre; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#define _BSD_SOURCE
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <getopt.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/queue.h>
-#include <signal.h>
-
-#include <sysio.h>
-#include <mount.h>
-
-#include "test_common.h"
-
-
-
-static char mds_server[1024] = {0,};
-static char barrier_script[1024] = {0,};
-static char failover_script[1024] = {0,};
-static char barrier_cmd[1024] = {0,};
-static char failover_cmd[1024] = {0,};
-
-static void replay_barrier()
-{
-        int rc;
-
-        if ((rc = system(barrier_cmd))) {
-                printf("excute barrier error: %d\n", rc);
-                exit(rc);
-        }
-}
-
-static void mds_failover()
-{
-        int rc;
-
-        if ((rc = system(failover_cmd))) {
-                printf("excute failover error: %d\n", rc);
-                exit(rc);
-        }
-}
-
-
-#define ENTRY(str)                                                      \
-        do {                                                            \
-                char buf[100];                                          \
-                int len;                                                \
-                sprintf(buf, "===== START: %s ", (str));                \
-                len = strlen(buf);                                      \
-                if (len < 79) {                                         \
-                        memset(buf+len, '=', 100-len);                  \
-                        buf[79] = '\n';                                 \
-                        buf[80] = 0;                                    \
-                }                                                       \
-                printf("%s", buf);                                      \
-        } while (0)
-
-#define LEAVE()                                                         \
-        do {                                                            \
-                printf("----- END TEST successfully ---");              \
-                printf("-----------------------------");                \
-                printf("-------------------\n");                        \
-        } while (0)
-
-void t0()
-{
-        ENTRY("empty replay");
-        replay_barrier();
-        mds_failover();
-        LEAVE();
-}
-
-void t1()
-{
-        char *path="/mnt/lustre/f1";
-        ENTRY("simple create");
-
-        replay_barrier();
-        t_create(path);
-        mds_failover();
-        t_check_stat(path, NULL);
-        t_unlink(path);
-        LEAVE();
-}
-
-void t2a()
-{
-        char *path="/mnt/lustre/f2a";
-        ENTRY("touch");
-
-        replay_barrier();
-        t_touch(path);
-        mds_failover();
-        t_check_stat(path, NULL);
-        t_unlink(path);
-        LEAVE();
-}
-
-void t2b()
-{
-        char *path="/mnt/lustre/f2b";
-        ENTRY("mcreate+touch");
-
-        t_create(path);
-        replay_barrier();
-        t_touch(path);
-        mds_failover();
-        t_check_stat(path, NULL);
-        t_unlink(path);
-        LEAVE();
-}
-
-
-void n_create_delete(int nfiles)
-{
-        char *base="/mnt/lustre/f3_";
-        char path[100];
-        char str[100];
-        int i;
-
-        replay_barrier();
-        for (i = 0; i < nfiles; i++) {
-                sprintf(path, "%s%d\n", base, i);
-                sprintf(str, "TEST#%d CONTENT\n", i);
-                t_echo_create(path, str);
-        }
-        mds_failover();
-        for (i = 0; i < nfiles; i++) {
-                sprintf(path, "%s%d\n", base, i);
-                sprintf(str, "TEST#%d CONTENT\n", i);
-                t_grep(path, str);
-        }
-        replay_barrier();
-        for (i = 0; i < nfiles; i++) {
-                sprintf(path, "%s%d\n", base, i);
-                t_unlink(path);
-        }
-        mds_failover();
-        for (i = 0; i < nfiles; i++) {
-                sprintf(path, "%s%d\n", base, i);
-                t_check_stat_fail(path);
-        }
-        LEAVE();
-}
-
-void t3a()
-{
-        ENTRY("10 create/delete");
-        n_create_delete(10);
-        LEAVE();
-}
-
-void t3b()
-{
-        ENTRY("30 create/delete(>1'st block precreated)");
-        n_create_delete(30);
-        LEAVE();
-}
-
-void t4()
-{
-        char *dir="/mnt/lustre/d4";
-        char *path="/mnt/lustre/d4/f1";
-        ENTRY("mkdir + contained create");
-
-        replay_barrier();
-        t_mkdir(dir);
-        t_create(path);
-        mds_failover();
-        t_check_stat(dir, NULL);
-        t_check_stat(path, NULL);
-        sleep(2); /* wait for log process thread */
-
-        replay_barrier();
-        t_unlink(path);
-        t_rmdir(dir);
-        mds_failover();
-        t_check_stat_fail(dir);
-        t_check_stat_fail(path);
-        LEAVE();
-}
-
-void t5()
-{
-        char *dir="/mnt/lustre/d5";
-        char *path="/mnt/lustre/d5/f1";
-        ENTRY("mkdir |X| contained create");
-
-        t_mkdir(dir);
-        replay_barrier();
-        t_create(path);
-        mds_failover();
-        t_check_stat(dir, NULL);
-        t_check_stat(path, NULL);
-        t_unlink(path);
-        t_rmdir(dir);
-        LEAVE();
-}
-
-void t6()
-{
-        char *path="/mnt/lustre/f6";
-        int fd;
-        ENTRY("open |X| close");
-
-        replay_barrier();
-        t_create(path);
-        fd = t_open(path);
-        sleep(1);
-        mds_failover();
-        t_check_stat(path, NULL);
-        t_close(fd);
-        t_unlink(path);
-        LEAVE();
-}
-
-void t7()
-{
-        char *path="/mnt/lustre/f7";
-        char *path2="/mnt/lustre/f7-2";
-        ENTRY("create |X| rename unlink");
-
-        t_create(path);
-        replay_barrier();
-        t_rename(path, path2);
-        mds_failover();
-        t_check_stat_fail(path);
-        t_check_stat(path2, NULL);
-        t_unlink(path2);
-}
-
-void t8()
-{
-        char *path="/mnt/lustre/f8";
-        char *path2="/mnt/lustre/f8-2";
-        ENTRY("create open write rename |X| create-old-name read");
-
-        t_create(path);
-        t_echo_create(path, "old");
-        t_rename(path, path2);
-        replay_barrier();
-        t_echo_create(path, "new");
-        mds_failover();
-        t_grep(path, "new");
-        t_grep(path2, "old");
-        t_unlink(path);
-        t_unlink(path2);
-}
-
-void t9()
-{
-        char *path="/mnt/lustre/f9";
-        char *path2="/mnt/lustre/f9-2";
-        ENTRY("|X| open(O_CREAT), unlink, touch new, unlink new");
-
-        replay_barrier();
-        t_create(path);
-        t_unlink(path);
-        t_create(path2);
-        mds_failover();
-        t_check_stat_fail(path);
-        t_check_stat(path2, NULL);
-        t_unlink(path2);
-}
-
-void t10()
-{
-        char *path="/mnt/lustre/f10";
-        char *path2="/mnt/lustre/f10-2";
-        ENTRY("|X| mcreate, open write, rename");
-
-        replay_barrier();
-        t_create(path);
-        t_echo_create(path, "old");
-        t_rename(path, path2);
-        t_grep(path2, "old");
-        mds_failover();
-        t_grep(path2, "old");
-        t_unlink(path2);
-}
-
-extern int portal_debug;
-extern int portal_subsystem_debug;
-
-extern void __liblustre_setup_(void);
-extern void __liblustre_cleanup_(void);
-
-void usage(const char *cmd)
-{
-        printf("Usage: \t%s --target mdsnid:/mdsname/profile -s mds_hostname "
-                "-b \"barrier cmd\" -f \"failover cmd\"\n", cmd);
-        printf("       \t%s --dumpfile dumpfile -s mds_hostname -b \"barrier cmd\" "
-                "-f \"failover cmd\"\n", cmd);
-        exit(-1);
-}
-
-void test_ssh()
-{
-        char cmd[1024];
-
-        sprintf(cmd, "ssh %s cat /dev/null", mds_server);
-        if (system(cmd)) {
-                printf("ssh can't access server node: %s\n", mds_server);
-                exit(-1);
-        }
-}
-
-int main(int argc, char * const argv[])
-{
-        int opt_index, c;
-        static struct option long_opts[] = {
-                {"target", 1, 0, 0},
-                {"dumpfile", 1, 0, 0},
-                {0, 0, 0, 0}
-        };
-
-        if (argc < 4)
-                usage(argv[0]);
-
-        while ((c = getopt_long(argc, argv, "s:b:f:", long_opts, &opt_index)) != -1) {
-                switch (c) {
-                case 0: {
-                        if (!optarg[0])
-                                usage(argv[0]);
-
-                        if (!strcmp(long_opts[opt_index].name, "target")) {
-                                setenv(ENV_LUSTRE_MNTTGT, optarg, 1);
-                        } else if (!strcmp(long_opts[opt_index].name, "dumpfile")) {
-                                setenv(ENV_LUSTRE_DUMPFILE, optarg, 1);
-                        } else
-                                usage(argv[0]);
-                        break;
-                }
-                case 's':
-                        strcpy(mds_server, optarg);
-                        break;
-                case 'b':
-                        strcpy(barrier_script, optarg);
-                        break;
-                case 'f':
-                        strcpy(failover_script, optarg);
-                        break;
-                default:
-                        usage(argv[0]);
-                }
-        }
-
-        if (optind != argc)
-                usage(argv[0]);
-        if (!strlen(mds_server) || !strlen(barrier_script) ||
-            !strlen(failover_script))
-                usage(argv[0]);
-
-        test_ssh();
-
-        /* prepare remote command */
-        sprintf(barrier_cmd, "ssh %s \"%s\"", mds_server, barrier_script);
-        sprintf(failover_cmd, "ssh %s \"%s\"", mds_server, failover_script);
-
-        __liblustre_setup_();
-
-        t0();
-        t1();
-        t2a();
-        t2b();
-        t3a();
-        t3b();
-        t4();
-        t5();
-        t6();
-        t7();
-        t8();
-        t9();
-        t10();
-
-       printf("liblustre is about shutdown\n");
-        __liblustre_cleanup_();
-
-       printf("complete successfully\n");
-       return 0;
-}
diff --git a/lustre/liblustre/test_common.c b/lustre/liblustre/test_common.c
deleted file mode 100644 (file)
index 210d57e..0000000
+++ /dev/null
@@ -1,280 +0,0 @@
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <string.h>
-#include <errno.h>
-
-#include "test_common.h"
-
-int exit_on_err = 1;
-
-/******************************************************************
- * util functions
- ******************************************************************/
-
-#define EXIT(err)                                      \
-       do {                                            \
-               if (exit_on_err)                        \
-                       exit(err);                      \
-       } while (0)
-
-#define EXIT_RET(err)                                  \
-       do {                                            \
-               if (exit_on_err)                        \
-                       exit(err);                      \
-               else                                    \
-                       return (err);                   \
-       } while (0)
-
-
-void t_touch(const char *path)
-{
-        int fd, rc;
-
-        fd = open(path, O_RDWR|O_CREAT, 0644);
-        if (fd < 0) {
-                printf("open(%s) error: %s\n", path, strerror(errno));
-                EXIT(fd);
-        }
-
-        rc = close(fd);
-        if (rc) {
-                printf("close(%s) error: %s\n", path, strerror(errno));
-                EXIT(rc);
-        }
-}
-
-/* XXX Now libsysio don't support mcreate */
-void t_create(const char *path)
-{
-        return t_touch(path);
-#if 0
-        int rc;
-
-        rc = mknod(path, S_IFREG | 0644, 0);
-        if (rc) {
-                printf("mknod(%s) error: %s\n", path, strerror(errno));
-                exit(-1);
-        }
-#endif
-}
-
-void t_link(const char *src, const char *dst)
-{
-       int rc;
-
-       rc = link(src, dst);
-       if (rc) {
-               printf("link(%s -> %s) error: %s\n", src, dst, strerror(errno));
-               EXIT(1);
-       }
-}
-
-void t_unlink(const char *path)
-{
-        int rc;
-
-        rc = unlink(path);
-        if (rc) {
-                printf("unlink(%s) error: %s\n", path, strerror(errno));
-                EXIT(-1);
-        }
-}
-
-void t_mkdir(const char *path)
-{
-        int rc;
-
-        rc = mkdir(path, 00644);
-        if (rc < 0) {
-                printf("mkdir(%s) error: %s\n", path, strerror(errno));
-                EXIT(1);
-        }
-}
-
-void t_rmdir(const char *path)
-{
-        int rc;
-
-        rc = rmdir(path);
-        if (rc) {
-                printf("rmdir(%s) error: %s\n", path, strerror(errno));
-                EXIT(1);
-        }
-}
-
-void t_symlink(const char *src, const char *new)
-{
-       int rc;
-
-       rc = symlink(src, new);
-       if (rc) {
-               printf("symlink(%s<-%s) error: %s\n", src, new, strerror(errno));
-               EXIT(1);
-       }
-}
-
-#define MKDEV(a,b) (((a) << 8) | (b))
-void t_mknod(const char *path, mode_t mode, int major, int minor)
-{
-       int rc;
-
-        rc = mknod(path, mode, MKDEV(5, 4));
-        if (rc) {
-                printf("mknod(%s) error: %s\n", path, strerror(errno));
-                EXIT(1);
-        }
-}
-
-void t_chmod_raw(const char *path, mode_t mode)
-{
-       int rc;
-       
-       rc = chmod(path, mode);
-       if (rc) {
-                printf("chmod(%s) error: %s\n", path, strerror(errno));
-                EXIT(1);
-        }
-}
-
-void t_chmod(const char *path, const char *format, ...)
-{
-}
-
-void t_rename(const char *oldpath, const char *newpath)
-{
-        int rc;
-
-        rc = rename(oldpath, newpath);
-        if (rc) {
-                printf("rename(%s -> %s) error: %s\n",
-                      oldpath, newpath, strerror(errno));
-                EXIT(1);
-        }
-}
-
-int t_open_readonly(const char *path)
-{
-        int fd;
-
-        fd = open(path, O_RDONLY);
-        if (fd < 0) {
-                printf("open(%s) error: %s\n", path, strerror(errno));
-                EXIT_RET(fd);
-        }
-        return fd;
-}
-
-int t_open(const char *path)
-{
-        int fd;
-
-        fd = open(path, O_RDWR);
-        if (fd < 0) {
-                printf("open(%s) error: %s\n", path, strerror(errno));
-                EXIT_RET(fd);
-        }
-        return fd;
-}
-
-void t_close(int fd)
-{
-        int rc;
-
-        rc = close(fd);
-        if (rc < 0) {
-                printf("close(%d) error: %s\n", fd, strerror(errno));
-                EXIT(1);
-        }
-}
-
-int t_check_stat(const char *name, struct stat *buf)
-{
-       struct stat stat;
-        int rc;
-
-       rc = lstat(name, &stat);
-        if (rc) {
-               printf("error %d stat %s\n", rc, name);
-               EXIT_RET(rc);
-       }
-        if (buf)
-                memcpy(buf, &stat, sizeof(*buf));
-
-       return 0;
-}
-
-int t_check_stat_fail(const char *name)
-{
-       struct stat stat;
-        int rc;
-
-       rc = lstat(name, &stat);
-        if (!rc) {
-               printf("%s still exists\n", name);
-               EXIT(-1);
-       }
-
-       return 0;
-}
-
-void t_echo_create(const char *path, const char *str)
-{
-        int fd, rc;
-
-        fd = open(path, O_RDWR|O_CREAT, 0644);
-        if (fd < 0) {
-                printf("open(%s) error: %s\n", path, strerror(errno));
-                EXIT(fd);
-        }
-
-       if (write(fd, str, strlen(str)+1) != strlen(str)+1) {
-                printf("write(%s) error: %s\n", path, strerror(errno));
-                EXIT(fd);
-       }
-
-        rc = close(fd);
-        if (rc) {
-                printf("close(%s) error: %s\n", path, strerror(errno));
-                EXIT(rc);
-        }
-}
-
-void _t_grep(const char *path, char *str, int should_contain)
-{
-       char buf[1024];
-       int fd;
-       int rc;
-       
-       fd = t_open_readonly(path);
-       if (lseek(fd, 0, SEEK_SET) == -1) {
-               printf("pread_once: seek to 0 error: %s\n", strerror(errno));
-               EXIT(fd);
-       }
-
-       rc = read(fd, buf, 1023);
-       if (rc < 0) {
-               printf("grep: read error: %s\n", strerror(errno));
-               EXIT(-1);
-       }
-       close(fd);
-       buf[rc] = 0;
-
-       if ((strstr(buf, str) != 0) ^ should_contain) {
-               printf("grep: can't find string %s\n", str);
-               EXIT(-1);
-       }
-}
-
-void t_grep(const char *path, char *str)
-{
-       _t_grep(path, str, 1);
-}
-
-void t_grep_v(const char *path, char *str)
-{
-       _t_grep(path, str, 0);
-}
diff --git a/lustre/liblustre/test_common.h b/lustre/liblustre/test_common.h
deleted file mode 100644 (file)
index af638f2..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef __TEST_COMMON__H
-#define __TEST_COMMON__H
-
-#define ENV_LUSTRE_MNTPNT               "LIBLUSTRE_MOUNT_POINT"
-#define ENV_LUSTRE_MNTTGT               "LIBLUSTRE_MOUNT_TARGET"
-#define ENV_LUSTRE_DUMPFILE             "LIBLUSTRE_DUMPFILE"
-
-extern int exit_on_err;
-
-void t_touch(const char *path);
-void t_create(const char *path);
-void t_link(const char *src, const char *dst);
-void t_unlink(const char *path);
-void t_mkdir(const char *path);
-void t_rmdir(const char *path);
-void t_symlink(const char *src, const char *new);
-void t_mknod(const char *path, mode_t mode, int major, int minor);
-void t_chmod_raw(const char *path, mode_t mode);
-void t_chmod(const char *path, const char *format, ...);
-void t_rename(const char *oldpath, const char *newpath);
-int t_open_readonly(const char *path);
-int t_open(const char *path);
-void t_close(int fd);
-int t_check_stat(const char *name, struct stat *buf);
-int t_check_stat_fail(const char *name);
-void t_echo_create(const char *path, const char *str);
-//int t_pread_once(const char *path, char *buf, size_t size, off_t offset);
-void t_grep(const char *path, char *str);
-void t_grep_v(const char *path, char *str);
-
-#endif
diff --git a/lustre/liblustre/test_lock_cancel.c b/lustre/liblustre/test_lock_cancel.c
deleted file mode 100644 (file)
index 9350e4c..0000000
+++ /dev/null
@@ -1,194 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- * Lustre Light user test program
- *
- *  Copyright (c) 2002, 2003 Cluster File Systems, Inc.
- *
- *   This file is part of Lustre, http://www.lustre.org.
- *
- *   Lustre is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   Lustre is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with Lustre; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#define _BSD_SOURCE
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <getopt.h>
-#include <string.h>
-#include <time.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/queue.h>
-
-#include <sysio.h>
-#include <mount.h>
-
-#include <test_common.h>
-
-#include <mpi.h>
-
-/******************************************************************************/
-/*
- * MPI_CHECK will display a custom error message as well as an error string
- * from the MPI_STATUS and then exit the program
- */
-
-#define MPI_CHECK(MPI_STATUS, MSG) do {                                  \
-    char resultString[MPI_MAX_ERROR_STRING];                             \
-    int resultLength;                                                    \
-                                                                         \
-    if (MPI_STATUS != MPI_SUCCESS) {                                     \
-        fprintf(stdout, "** error **\n");                                \
-        fprintf(stdout, "ERROR in %s (line %d): %s.\n",                  \
-                __FILE__, __LINE__, MSG);                                \
-        MPI_Error_string(MPI_STATUS, resultString, &resultLength);       \
-        fprintf(stdout, "MPI %s\n", resultString);                       \
-        fprintf(stdout, "** exiting **\n");                              \
-        MPI_Abort(MPI_COMM_WORLD, 1);                                    \
-    }                                                                    \
-} while(0)
-
-int            numTasks     = 0,       /* MPI variables */
-               rank         = 0,
-               tasksPerNode = 0;       /* tasks per node */
-
-
-
-
-static char *test_file_name = "/mnt/lustre/test_lock_cancel";
-
-extern void __liblustre_setup_(void);
-extern void __liblustre_cleanup_(void);
-
-void usage(char *cmd)
-{
-        printf("Usage: \t%s --target mdsnid:/mdsname/profile\n", cmd);
-        printf("       \t%s --dumpfile dumpfile\n", cmd);
-        exit(-1);
-}
-
-int main(int argc, char *argv[])
-{
-        int opt_index, c;
-        static struct option long_opts[] = {
-                {"target", 1, 0, 0},
-                {"dumpfile", 1, 0, 0},
-                {0, 0, 0, 0}
-        };
-       int fd;
-        long time1, time2;
-        struct stat statbuf;
-
-        if (argc < 3)
-                usage(argv[0]);
-
-        while ((c = getopt_long(argc, argv, "", long_opts, &opt_index)) != -1) {
-                switch (c) {
-                case 0: {
-                        if (!optarg[0])
-                                usage(argv[0]);
-
-                        if (!strcmp(long_opts[opt_index].name, "target")) {
-                                setenv(ENV_LUSTRE_MNTTGT, optarg, 1);
-                        } else if (!strcmp(long_opts[opt_index].name, "dumpfile")) {
-                                setenv(ENV_LUSTRE_DUMPFILE, optarg, 1);
-                        } else
-                                usage(argv[0]);
-                        break;
-                }
-                default:
-                        usage(argv[0]);
-                }
-        }
-
-        if (optind != argc)
-                usage(argv[0]);
-
-        __liblustre_setup_();
-
-       MPI_CHECK(MPI_Init(&argc, &argv), "MPI_Init()");
-       MPI_CHECK(MPI_Comm_size(MPI_COMM_WORLD, &numTasks), "MPI_Comm_size");
-       MPI_CHECK(MPI_Comm_rank(MPI_COMM_WORLD, &rank), "MPI_Comm_rank");
-
-        if (numTasks < 2) {
-                printf("this demo can't run on single node!\n");
-                goto cleanup;
-        }
-
-        if (rank == 0) {
-                unlink(test_file_name);
-        }
-
-        MPI_Barrier(MPI_COMM_WORLD);
-        if (rank == 1) {
-                printf("Node 1: creating file %s ...\n", test_file_name);
-                fflush(stdout);
-
-                fd = open(test_file_name, O_CREAT|O_RDWR, 0755);
-                if (fd < 0) {
-                        printf("Node %d: creat file err: %d", rank, fd);
-                        fflush(stdout);
-                        goto cleanup;
-                }
-                close(fd);
-                printf("Node 1: done creation. perform stat on file %s ...\n", test_file_name);
-                fflush(stdout);
-
-                if (stat(test_file_name, &statbuf)) {
-                        printf("Node %d: stat file err: %d", rank, fd);
-                        fflush(stdout);
-                        goto cleanup;
-                }
-
-                printf("Node %d: done stat on file\n", rank);
-                fflush(stdout);
-        } else {
-                printf("Node %d: waiting node 1 create & stat file\n", rank);
-                fflush(stdout);
-        }
-
-        MPI_Barrier(MPI_COMM_WORLD);
-        
-        if (rank == 1) {
-                printf("Node 1: file has been create+stat, abort excution here!!!!!!!\n");
-                fflush(stdout);
-                exit(0);
-        }
-        
-        sleep(1);
-        printf("Node %d: synced with Node 1. sleep 5 seconds...\n", rank);
-        fflush(stdout);
-        sleep(5);
-        printf("Node %d: wakeup from sleep. perform unlink()...\n", rank);
-        fflush(stdout);
-
-        time1 = time(NULL);
-        if (unlink(test_file_name)) {
-                printf("Node %d: error unlink file: %d\n", rank, fd);
-                fflush(stdout);
-                goto cleanup;
-        }
-        time2 = time(NULL);
-        printf("Node %d: successfully unlink file, cost %ld seconds.\n",
-                rank, time2 - time1);
-        fflush(stdout);
-
-cleanup:
-        __liblustre_cleanup_();
-        printf("Node %d: end sucessfully.\n", rank);
-       return 0;
-}
index 7edee0d..21e884f 100644 (file)
@@ -107,22 +107,21 @@ static int ll_writepage_26(struct page *page, struct writeback_control *wbc)
         llap = llap_from_page(page);
         if (IS_ERR(llap))
                 GOTO(out, rc = PTR_ERR(llap));
-        page_cache_get(page);
 
+        page_cache_get(page);
         if (llap->llap_write_queued) {
                 LL_CDEBUG_PAGE(page, "marking urgent\n");
-                rc = obd_set_async_flags(exp, ll_i2info(inode)->lli_smd, NULL, 
-                                         llap->llap_cookie, ASYNC_READY | 
-                                         ASYNC_URGENT);
+                rc = obd_set_async_flags(exp, ll_i2info(inode)->lli_smd, NULL,
+                                         llap->llap_cookie,
+                                         ASYNC_READY | ASYNC_URGENT);
         } else {
                 llap->llap_write_queued = 1;
-                rc = obd_queue_async_io(exp, ll_i2info(inode)->lli_smd, NULL, 
-                                        llap->llap_cookie, OBD_BRW_WRITE, 0, 0, 
-                                        OBD_BRW_CREATE, ASYNC_READY | 
-                                        ASYNC_URGENT);
+                rc = obd_queue_async_io(exp, ll_i2info(inode)->lli_smd, NULL,
+                                        llap->llap_cookie, OBD_BRW_WRITE, 0, 0,
+                                        0, ASYNC_READY | ASYNC_URGENT);
                 if (rc == 0)
                         LL_CDEBUG_PAGE(page, "mmap write queued\n");
-                else 
+                else
                         llap->llap_write_queued = 0;
         }
         if (rc)
index 3006306..1fd7dd1 100644 (file)
@@ -14,8 +14,9 @@ endif
 
 
 if LIBLUSTRE
-lib_LIBRARIES = liblvfs.a
+noinst_LIBRARIES = liblvfs.a
 liblvfs_a_SOURCES = lvfs_userfs.c
+liblvfs_a_CFLAGS = -fPIC
 
 #if MYSQL
 #liblvfs_a_SOURCES += lvfs_user_mysql.c
index 549c760..c4d5690 100644 (file)
@@ -82,7 +82,8 @@ static int mds_llog_repl_cancel(struct llog_ctxt *ctxt, struct lov_stripe_md *ls
 }
 
 int mds_log_op_unlink(struct obd_device *obd, struct inode *inode,
-                      struct lustre_msg *repmsg, int offset)
+                      struct lov_mds_md *lmm, int lmm_size,
+                      struct llog_cookie *logcookies, int cookies_size)
 {
         struct mds_obd *mds = &obd->u.mds;
         struct lov_stripe_md *lsm = NULL;
@@ -94,14 +95,13 @@ int mds_log_op_unlink(struct obd_device *obd, struct inode *inode,
                 RETURN(PTR_ERR(mds->mds_osc_obd));
 
         rc = obd_unpackmd(mds->mds_osc_exp, &lsm,
-                          lustre_msg_buf(repmsg, offset, 0),
-                          repmsg->buflens[offset]);
+                          lmm, lmm_size);
         if (rc < 0)
                 RETURN(rc);
 
         ctxt = llog_get_context(obd, LLOG_UNLINK_ORIG_CTXT);
-        rc = llog_add(ctxt, NULL, lsm, lustre_msg_buf(repmsg, offset + 1, 0),
-                      repmsg->buflens[offset + 1] / sizeof(struct llog_cookie));
+        rc = llog_add(ctxt, NULL, lsm, logcookies,
+                      cookies_size / sizeof(struct llog_cookie));
 
         obd_free_memmd(mds->mds_osc_exp, &lsm);
 
@@ -123,7 +123,7 @@ int mds_llog_init(struct obd_device *obd, struct obd_device *tgt,
         struct obd_device *lov_obd = obd->u.mds.mds_osc_obd;
         int rc;
         ENTRY;
-        
+
         rc = llog_setup(obd, LLOG_UNLINK_ORIG_CTXT, tgt, 0, NULL,
                         &mds_unlink_orig_logops);
         if (rc)
@@ -134,9 +134,9 @@ int mds_llog_init(struct obd_device *obd, struct obd_device *tgt,
         if (rc)
                 RETURN(rc);
 
-        rc = obd_llog_init(lov_obd, tgt, count, logid);        
-        if (rc) 
-                CERROR("error lov_llog_init\n"); 
+        rc = obd_llog_init(lov_obd, tgt, count, logid);
+        if (rc)
+                CERROR("error lov_llog_init\n");
 
         RETURN(rc);
 }
@@ -146,7 +146,7 @@ int mds_llog_finish(struct obd_device *obd, int count)
         struct obd_device *lov_obd = obd->u.mds.mds_osc_obd;
         int rc;
         ENTRY;
-        
+
         rc = llog_cleanup(llog_get_context(obd, LLOG_UNLINK_ORIG_CTXT));
         if (rc)
                 RETURN(rc);
@@ -155,9 +155,9 @@ int mds_llog_finish(struct obd_device *obd, int count)
         if (rc)
                 RETURN(rc);
 
-        rc = obd_llog_finish(lov_obd, count);        
-        if (rc) 
-                CERROR("error lov_llog_finish\n"); 
+        rc = obd_llog_finish(lov_obd, count);
+        if (rc)
+                CERROR("error lov_llog_finish\n");
 
         RETURN(rc);
 }
index 51abb74..8743e72 100644 (file)
@@ -32,7 +32,6 @@
 #include <linux/obd_class.h>
 #include <linux/lustre_net.h>
 
-#define MGMT_NEVENTS     1024UL
 #define MGMT_NBUFS       128UL
 #define MGMT_BUFSIZE     8192
 #define MGMT_MAXREQSIZE  512
@@ -89,10 +88,11 @@ static int mgmt_setup(struct obd_device *obd, obd_count len, void *buf)
         if (mgmt_initialized)
                 RETURN(-EALREADY);
         
-        mgmt_service = ptlrpc_init_svc(MGMT_NEVENTS, MGMT_NBUFS, MGMT_BUFSIZE,
-                                       MGMT_MAXREQSIZE, MGMT_REQUEST_PORTAL,
-                                       MGMT_REPLY_PORTAL, mgmt_handler,
-                                       "mgmt", obd->obd_proc_entry);
+        mgmt_service = 
+                ptlrpc_init_svc(MGMT_NBUFS, MGMT_BUFSIZE, MGMT_MAXREQSIZE, 
+                                MGMT_REQUEST_PORTAL, MGMT_REPLY_PORTAL, 
+                                mgmt_handler, "mgmt",
+                                obd->obd_proc_entry);
         if (!mgmt_service) {
                 CERROR("Failed to start mgmt service\n");
                 RETURN(-ENOMEM);
index 82ceab4..e4146dc 100644 (file)
@@ -215,7 +215,6 @@ int llog_process(struct llog_handle *loghandle, llog_cb_t cb,
         else
                 last_index = LLOG_BITMAP_BYTES * 8 - 1;
 
-
         while (rc == 0) {
                 struct llog_rec_hdr *rec;
 
index cc0007f..fb43702 100644 (file)
 
 #warning "implement writeback mode -bzzz"
 
-int ext3_map_inode_page(struct inode *inode, struct page *page,
-                        unsigned long *blocks, int *created, int create);
-
 /* 512byte block min */
 #define MAX_BLOCKS_PER_PAGE (PAGE_SIZE / 512)
 struct dio_request {
         atomic_t numreqs;       /* number of reqs being processed */
         struct bio *bio_list;   /* list of completed bios */
         wait_queue_head_t wait;
-       int created[MAX_BLOCKS_PER_PAGE];
-       unsigned long blocks[MAX_BLOCKS_PER_PAGE];
+        int created[MAX_BLOCKS_PER_PAGE];
+        unsigned long blocks[MAX_BLOCKS_PER_PAGE];
         spinlock_t lock;
 };
 
@@ -68,13 +65,34 @@ static int dio_complete_routine(struct bio *bio, unsigned int done, int error)
 
 static int can_be_merged(struct bio *bio, sector_t sector)
 {
-       int size;
-       
-       if (!bio)
-               return 0;
-       
-       size = bio->bi_size >> 9;
-       return bio->bi_sector + size == sector ? 1 : 0;
+        int size;
+
+        if (!bio)
+                return 0;
+
+        size = bio->bi_size >> 9;
+        return bio->bi_sector + size == sector ? 1 : 0;
+}
+
+/* See if there are unallocated parts in given file region */
+static int filter_range_is_mapped(struct inode *inode, obd_size offset, int len)
+{
+        sector_t (*fs_bmap)(struct address_space *, sector_t) =
+                inode->i_mapping->a_ops->bmap;
+        int j;
+
+        /* We can't know if we are overwriting or not */
+        if (fs_bmap == NULL)
+                return 0;
+
+        offset >>= inode->i_blkbits;
+        len >>= inode->i_blkbits;
+
+        for (j = 0; j <= len; j++)
+                if (fs_bmap(inode->i_mapping, offset + j) == 0)
+                        return 0;
+
+        return 1;
 }
 
 int filter_commitrw_write(struct obd_export *exp, struct obdo *oa, int objcount,
@@ -89,7 +107,7 @@ int filter_commitrw_write(struct obd_export *exp, struct obdo *oa, int objcount,
         struct inode *inode = NULL;
         int rc = 0, i, k, cleanup_phase = 0, err;
         unsigned long now = jiffies; /* DEBUGGING OST TIMEOUTS */
-       int blocks_per_page;
+        int blocks_per_page;
         struct dio_request *dreq;
         struct bio *bio = NULL;
         ENTRY;
@@ -99,7 +117,7 @@ int filter_commitrw_write(struct obd_export *exp, struct obdo *oa, int objcount,
 
         inode = res->dentry->d_inode;
         blocks_per_page = PAGE_SIZE >> inode->i_blkbits;
-       LASSERT(blocks_per_page <= MAX_BLOCKS_PER_PAGE);
+        LASSERT(blocks_per_page <= MAX_BLOCKS_PER_PAGE);
 
         OBD_ALLOC(dreq, sizeof(*dreq));
         if (dreq == NULL)
@@ -114,7 +132,7 @@ int filter_commitrw_write(struct obd_export *exp, struct obdo *oa, int objcount,
         fso.fso_bufcnt = obj->ioo_bufcnt;
 
         push_ctxt(&saved, &obd->obd_ctxt, NULL);
-        cleanup_phase = 2; 
+        cleanup_phase = 2;
 
         oti->oti_handle = fsfilt_brw_start(obd, objcount, &fso, niocount, oti);
         if (IS_ERR(oti->oti_handle)) {
@@ -128,39 +146,48 @@ int filter_commitrw_write(struct obd_export *exp, struct obdo *oa, int objcount,
         if (time_after(jiffies, now + 15 * HZ))
                 CERROR("slow brw_start %lus\n", (jiffies - now) / HZ);
 
+        iattr_from_obdo(&iattr,oa,OBD_MD_FLATIME|OBD_MD_FLMTIME|OBD_MD_FLCTIME);
         for (i = 0, lnb = res; i < obj->ioo_bufcnt; i++, lnb++) {
                 loff_t this_size;
-               sector_t sector;
-               int offs;
+                sector_t sector;
+                int offs;
+
+                /* If overwriting an existing block, we don't need a grant */
+                if (!(lnb->flags & OBD_BRW_GRANTED) && lnb->rc == -ENOSPC &&
+                    filter_range_is_mapped(inode, lnb->offset, lnb->len))
+                        lnb->rc = 0;
+
+                if (lnb->rc) /* ENOSPC, network RPC error */
+                        continue;
 
-               /* get block number for next page */
-                rc = ext3_map_inode_page(inode, lnb->page, dreq->blocks,
-                                                dreq->created, 1);
+                /* get block number for next page */
+                rc = fsfilt_map_inode_page(obd, inode, lnb->page, dreq->blocks,
+                                           dreq->created, 1);
                 if (rc)
                         GOTO(cleanup, rc);
 
-               for (k = 0; k < blocks_per_page; k++) {
-                       sector = dreq->blocks[k] * (inode->i_sb->s_blocksize >> 9);
-                       offs = k * inode->i_sb->s_blocksize;
+                for (k = 0; k < blocks_per_page; k++) {
+                        sector = dreq->blocks[k] *(inode->i_sb->s_blocksize>>9);
+                        offs = k * inode->i_sb->s_blocksize;
 
-                       if (!bio || !can_be_merged(bio, sector) ||
-                               !bio_add_page(bio, lnb->page, lnb->len, offs)) {
-                               if (bio) {
+                        if (!bio || !can_be_merged(bio, sector) ||
+                            !bio_add_page(bio, lnb->page, lnb->len, offs)) {
+                                if (bio) {
                                         atomic_inc(&dreq->numreqs);
-                                       submit_bio(WRITE, bio);
-                                       bio = NULL;
-                               }
-                               /* allocate new bio */
-                               bio = bio_alloc(GFP_NOIO, obj->ioo_bufcnt);
-                               bio->bi_bdev = inode->i_sb->s_bdev;
-                               bio->bi_sector = sector;
-                               bio->bi_end_io = dio_complete_routine; 
+                                        submit_bio(WRITE, bio);
+                                        bio = NULL;
+                                }
+                                /* allocate new bio */
+                                bio = bio_alloc(GFP_NOIO, obj->ioo_bufcnt);
+                                bio->bi_bdev = inode->i_sb->s_bdev;
+                                bio->bi_sector = sector;
+                                bio->bi_end_io = dio_complete_routine;
                                 bio->bi_private = dreq;
 
-                               if (!bio_add_page(bio, lnb->page, lnb->len, 0))
-                                       LBUG();
-                       }
-               }
+                                if (!bio_add_page(bio, lnb->page, lnb->len, 0))
+                                        LBUG();
+                        }
+                }
 
                 /* We expect these pages to be in offset order, but we'll
                  * be forgiving */
@@ -168,12 +195,16 @@ int filter_commitrw_write(struct obd_export *exp, struct obdo *oa, int objcount,
                 if (this_size > iattr.ia_size)
                         iattr.ia_size = this_size;
         }
-       if (bio) {
+
+#warning This probably needs filemap_fdatasync() like filter_io_24 (bug 2366)
+        if (bio) {
                 atomic_inc(&dreq->numreqs);
                 submit_bio(WRITE, bio);
         }
 
-       /* time to wait for I/O completion */
+        filter_grant_commit(exp, niocount, res);
+
+        /* time to wait for I/O completion */
         wait_event(dreq->wait, atomic_read(&dreq->numreqs) == 0);
 
         /* free all bios */
@@ -185,7 +216,6 @@ int filter_commitrw_write(struct obd_export *exp, struct obdo *oa, int objcount,
 
         if (rc == 0) {
                 down(&inode->i_sem);
-                inode_update_time(inode, 1);
                 if (iattr.ia_size > inode->i_size) {
                         CDEBUG(D_INFO, "setting i_size to "LPU64"\n",
                                iattr.ia_size);
index 4171df6..a0d3530 100644 (file)
@@ -321,7 +321,6 @@ gmnal_small_rx(nal_cb_t *nal_cb, void *private, lib_msg_t *cookie,
 
        if (!private) {
                CDEBUG(D_ERROR, "gmnal_small_rx no context\n");
-               lib_finalize(nal_cb, private, cookie);
                return(PTL_FAIL);
        }
 
@@ -343,10 +342,8 @@ gmnal_small_rx(nal_cb_t *nal_cb, void *private, lib_msg_t *cookie,
         *      let portals library know receive is complete
         */
        CDEBUG(D_PORTALS, "calling lib_finalize\n");
-       if (lib_finalize(nal_cb, private, cookie) != PTL_OK) {
-               /* TO DO what to do with failed lib_finalise? */
-               CDEBUG(D_INFO, "lib_finalize failed\n");
-       }
+       lib_finalize(nal_cb, private, cookie, PTL_OK);
+
        /*
         *      return buffer so it can be used again
         */
@@ -590,10 +587,8 @@ gmnal_small_tx_callback(gm_port_t *gm_port, void *context, gm_status_t status)
                return;
        }
        gmnal_return_stxd(nal_data, stxd);
-       if (lib_finalize(nal_cb, stxd, cookie) != PTL_OK) {
-               CDEBUG(D_INFO, "Call to lib_finalize failed for stxd [%p]\n", 
-                      stxd);
-       }
+       lib_finalize(nal_cb, stxd, cookie, PTL_OK);
+
        return;
 }
 
@@ -817,7 +812,6 @@ gmnal_large_rx(nal_cb_t *nal_cb, void *private, lib_msg_t *cookie,
 
        if (!srxd) {
                CDEBUG(D_ERROR, "gmnal_large_rx no context\n");
-               lib_finalize(nal_cb, private, cookie);
                return(PTL_FAIL);
        }
 
@@ -1114,10 +1108,7 @@ gmnal_remote_get_callback(gm_port_t *gm_port, void *context,
         *      Let our client application proceed
         */     
        CDEBUG(D_ERROR, "final callback context[%p]\n", srxd);
-       if (lib_finalize(nal_cb, srxd, srxd->cookie) != PTL_OK) {
-               CDEBUG(D_INFO, "Call to lib_finalize failed for srxd [%p]\n", 
-                      srxd);
-       }
+       lib_finalize(nal_cb, srxd, srxd->cookie, PTL_OK);
 
        /*
         *      send an ack to the sender to let him know we got the data
@@ -1282,10 +1273,7 @@ gmnal_large_tx_ack_received(gmnal_data_t *nal_data, gmnal_srxd_t *srxd)
 
        CDEBUG(D_INFO, "gmnal_large_tx_ack_received stxd [%p]\n", stxd);
 
-       if (lib_finalize(nal_cb, stxd, stxd->cookie) != PTL_OK) {
-               CDEBUG(D_INFO, "Call to lib_finalize failed for stxd [%p]\n", 
-                      stxd);
-       }
+       lib_finalize(nal_cb, stxd, stxd->cookie, PTL_OK);
 
        /*
         *      extract the iovec from the stxd, deregister the memory.
index 2c07cc4..0688062 100644 (file)
@@ -306,7 +306,7 @@ kibnal_send(nal_cb_t        *nal,
           if(buf_length > MAX_MSG_SIZE) { 
              CERROR("kibnal_send:request exceeds Transmit data size (%d).\n",
                       MAX_MSG_SIZE);
-             rc = -1;
+             rc = PTL_FAIL;
              return rc;
           }
           else {
@@ -363,7 +363,7 @@ kibnal_send(nal_cb_t        *nal,
 
         PROF_FINISH(kibnal_send); // time stapm of send operation 
 
-        rc = 1;
+        rc = PTL_OK;
 
         return rc; 
 }
@@ -386,7 +386,7 @@ int kibnal_send_pages(nal_cb_t * nal,
                       ptl_kiov_t *iov, 
                       size_t mlen)
 {
-   int rc = 1;
+   int rc = PTL_FAIL;
 
    CDEBUG(D_NET, "kibnal_send_pages\n");
 
@@ -420,7 +420,7 @@ void kibnal_fwd_packet (void *arg, kpr_fwd_desc_t *fwd)
 //
 // do you need this 
 //
-int kibnal_callback(nal_cb_t * nal, 
+void kibnal_callback(nal_cb_t * nal, 
                            void *private, 
                            lib_eq_t *eq,
                            ptl_event_t *ev)
@@ -507,7 +507,7 @@ kibnal_recv_pages(nal_cb_t * nal,
 {
 
   CDEBUG(D_NET, "recv_pages not implemented\n");
-  return PTL_OK;
+  return PTL_FAIL;
        
 }
 
@@ -526,11 +526,12 @@ kibnal_recv(nal_cb_t     *nal,
         CDEBUG(D_NET,"kibnal_recv: mlen=%d, rlen=%d\n", mlen, rlen);
 
         /* What was actually received must be >= what sender claims to
-         * have sent.  This is an LASSERT, since lib-move doesn't
-         * check cb return code yet. */
-        LASSERT (krx->krx_len >= sizeof (ptl_hdr_t) + rlen);
+         * have sent. */
         LASSERT (mlen <= rlen);
 
+        if (krx->krx_len < sizeof (ptl_hdr_t) + rlen)
+                return (PTL_FAIL);
+
         PROF_START(kibnal_recv);
 
         if(mlen != 0) {
@@ -542,12 +543,12 @@ kibnal_recv(nal_cb_t     *nal,
 
         PROF_START(lib_finalize);
         
-        lib_finalize(nal, private, cookie);
+        lib_finalize(nal, private, cookie, PTL_OK);
         
         PROF_FINISH(lib_finalize);
         PROF_FINISH(kibnal_recv);
 
-        return rlen;
+        return PTL_OK;
 }
 
 //
index 63fd22b..5bc9e3f 100644 (file)
@@ -215,6 +215,10 @@ int ptlrpc_connect_import(struct obd_import *imp, char * new_uuid)
         if (!request)
                 GOTO(out, rc = -ENOMEM);
 
+#ifndef __KERNEL__
+        lustre_msg_add_op_flags(request->rq_reqmsg, MSG_CONNECT_LIBCLIENT);
+#endif
+
         request->rq_send_state = LUSTRE_IMP_CONNECTING;
         request->rq_replen = lustre_msg_size(0, NULL);
         request->rq_interpret_reply = ptlrpc_connect_interpret;
@@ -229,6 +233,7 @@ int ptlrpc_connect_import(struct obd_import *imp, char * new_uuid)
 
         if (aa->pcaa_initial_connect)
                 imp->imp_replayable = 1;
+
         ptlrpcd_add_req(request);
         rc = 0;
 out:
@@ -349,8 +354,10 @@ finish:
  out:
         if (rc != 0) {
                 IMPORT_SET_STATE(imp, LUSTRE_IMP_DISCON);
-                if (aa->pcaa_initial_connect && !imp->imp_initial_recov)
+                if (aa->pcaa_initial_connect && !imp->imp_initial_recov) {
+                        ptlrpc_set_import_active(imp, 0);
                         GOTO(norecov, rc);
+                }
                 CDEBUG(D_ERROR, 
                        "recovery of %s on %s failed (%d); restarting\n",
                        imp->imp_target_uuid.uuid,
@@ -441,7 +448,9 @@ int ptlrpc_import_recovery_state_machine(struct obd_import *imp)
                        imp->imp_connection->c_remote_uuid.uuid);
 
                 ptlrpc_set_import_active(imp, 1);
-                ptlrpc_resend(imp);
+                rc = ptlrpc_resend(imp);
+                if (rc)
+                        GOTO(out, rc);
                 IMPORT_SET_STATE(imp, LUSTRE_IMP_FULL);
         } 
 
index 0694bd1..cdd70e2 100644 (file)
@@ -56,7 +56,7 @@ int llog_origin_connect(struct llog_ctxt *ctxt, int count,
         ENTRY;
 
         if (list_empty(&ctxt->loc_handle->u.chd.chd_head)) {
-                CDEBUG(D_HA, "there is no record related to ctxt %p", ctxt);
+                CDEBUG(D_HA, "there is no record related to ctxt %p\n", ctxt);
                 RETURN(0);
         }
 
@@ -137,8 +137,7 @@ EXPORT_SYMBOL(llog_initiator_connect);
 #else /* !__KERNEL__ */
 
 int llog_origin_connect(struct llog_ctxt *ctxt, int count,
-                        struct llog_logid *logid,
-                        struct llog_ctxt_gen *gen)
+                        struct llog_logid *logid, struct llog_gen *gen)
 {
         return 0;
 }
index 3a851a8..c114961 100755 (executable)
@@ -328,7 +328,7 @@ build_lustre()
 {
     (( $BUILD_LUSTRE )) || return 0
     pushd "$TOPDIR" >/dev/null
-    make -j $JOBS -s
+    make -j $JOBS -s || fatal 1 "Error building Lustre."
     popd >/dev/null
 }
 
index dd373ba..7d50f07 100644 (file)
@@ -17,7 +17,7 @@ PDSH=${PDSH:-pdsh -S -w}
 
 MDSDEV=${MDSDEV:-/dev/sda1}
 MDSSIZE=${MDSSIZE:-50000}
-OSTDEV=${OSTDEV:-/tmp/ost-`hostname`}
+OSTDEV=${OSTDEV:-/tmp/ost1-`hostname`}
 OSTSIZE=${OSTSIZE:-20000}
 FSTYPE=${FSTYPE:-ext3}
 TIMEOUT=${TIMEOUT:-10}
index 0f58491..9380a2d 100644 (file)
@@ -21,14 +21,6 @@ init_test_env $@
 
 . ${CONFIG:=$LUSTRE/tests/cfg/local.sh}
 
-FORCE=${FORCE:-" --force"}
-
-if [ "$VERBOSE" == "true" ]; then
-       CMDVERBOSE=""
-else
-       CMDVERBOSE=" > /dev/null"
-fi
-
 gen_config() {
        rm -f $XMLCONFIG
 
@@ -51,33 +43,33 @@ gen_second_config() {
 
 start_mds() {
        echo "start mds service on `facet_active_host mds`"
-       start mds --reformat $MDSLCONFARGS $CMDVERBOSE || return 94
+       start mds --reformat $MDSLCONFARGS  || return 94
 }
 stop_mds() {
        echo "stop mds service on `facet_active_host mds`"
-       stop mds $@ $CMDVERBOSE || return 97 
+       stop mds $@  || return 97 
 }
 
 start_ost() {
        echo "start ost service on `facet_active_host ost`"
-       start ost --reformat $OSTLCONFARGS $CMDVERBOSE || return 95
+       start ost --reformat $OSTLCONFARGS  || return 95
 }
 
 stop_ost() {
        echo "stop ost service on `facet_active_host ost`"
-       stop ost $@ $CMDVERBOSE || return 98 
+       stop ost $@  || return 98 
 }
 
 mount_client() {
        local MOUNTPATH=$1
        echo "mount lustre on ${MOUNTPATH}....."
-       zconf_mount `hostname`  $MOUNTPATH $CMDVERBOSE || return 96
+       zconf_mount `hostname`  $MOUNTPATH  || return 96
 }
 
 umount_client() {
        local MOUNTPATH=$1
        echo "umount lustre on ${MOUNTPATH}....."
-       zconf_umount $MOUNTPATH $CMDVERBOSE || return 97
+       zconf_umount `hostname`  $MOUNTPATH || return 97
 }
 
 manual_umount_client(){
@@ -136,7 +128,7 @@ run_test 0 "single mount setup"
 test_1() {
        start_ost
        echo "start ost second time..."
-       start ost --reformat $OSTLCONFARGS $CMDVERBOSE 
+       start ost --reformat $OSTLCONFARGS 
        start_mds       
        mount_client $MOUNT
        check_mount || return 42
@@ -148,7 +140,7 @@ test_2() {
        start_ost
        start_mds       
        echo "start mds second time.."
-       start mds --reformat $MDSLCONFARGS $CMDVERBOSE 
+       start mds --reformat $MDSLCONFARGS 
        
        mount_client $MOUNT  
        check_mount || return 43
@@ -170,7 +162,7 @@ run_test 3 "mount client twice"
 test_4() {
        setup
        touch $DIR/$tfile || return 85
-       stop_ost ${FORCE}
+       stop_ost --force
        cleanup 
        eno=$?
        # ok for ost to fail shutdown
@@ -184,16 +176,17 @@ run_test 4 "force cleanup ost, then cleanup"
 test_5() {
        setup
        touch $DIR/$tfile || return 1
-       stop_mds ${FORCE} || return 2
+       stop_mds --force || return 2
 
        # cleanup may return an error from the failed 
        # disconnects; for now I'll consider this successful 
        # if all the modules have unloaded.
        umount $MOUNT &
        UMOUNT_PID=$!
-       sleep $TIMEOUT
+       sleep 2
        echo "killing umount"
        kill -TERM $UMOUNT_PID
+       echo "waiting for umount to finish"
        wait $UMOUNT_PID 
 
        # cleanup client modules
@@ -208,6 +201,48 @@ test_5() {
 }
 run_test 5 "force cleanup mds, then cleanup"
 
+test_5b() {
+       start_ost
+       start_mds
+       stop_mds
+
+       [ -d $MOUNT ] || mkdir -p $MOUNT
+       $LCONF --nosetup --node client_facet $XMLCONFIG > /dev/null 
+       llmount $mds_HOST://mds_svc/client_facet $MOUNT  && exit 1
+
+       # cleanup client modules
+       $LCONF --cleanup --nosetup --node client_facet $XMLCONFIG > /dev/null 
+       
+       # stop_mds is a no-op here, and should not fail
+       stop_mds || return 2
+       stop_ost || return 3
+
+       lsmod | grep -q portals && return 3
+       return 0
+
+}
+run_test 5b "mds down, cleanup after failed mount (bug 2712)"
+
+test_5c() {
+       start_ost
+       start_mds
+
+       [ -d $MOUNT ] || mkdir -p $MOUNT
+       $LCONF --nosetup --node client_facet $XMLCONFIG > /dev/null 
+       llmount $mds_HOST://wrong_mds_svc/client_facet $MOUNT  && exit 1
+
+       # cleanup client modules
+       $LCONF --cleanup --nosetup --node client_facet $XMLCONFIG > /dev/null 
+       
+       stop_mds || return 2
+       stop_ost || return 3
+
+       lsmod | grep -q portals && return 3
+       return 0
+
+}
+run_test 5c "cleanup after failed mount (bug 2712)"
+
 test_6() {
        setup
        manual_umount_client
@@ -472,13 +507,13 @@ test_14() {
         add_lov lov1 mds --stripe_sz $STRIPE_BYTES\
             --stripe_cnt $STRIPES_PER_OBJ --stripe_pattern 0
         add_ost ost --lov lov1 --dev $OSTDEV --size $OSTSIZE \
-            --mkfsoptions -V
+            --mkfsoptions "-Llabel_conf_15"
         add_client client mds --lov lov1 --path $MOUNT
 
         FOUNDSTRING=`awk -F"<" '/<mkfsoptions>/{print $2}' $XMLCONFIG`
-        EXPECTEDSTRING="mkfsoptions>-V"
+        EXPECTEDSTRING="mkfsoptions>-Llabel_conf_15"
         if [ $EXPECTEDSTRING != $FOUNDSTRING ]; then
-                echo "Error:expected string: $EXPECTEDSTRING; found: $FOUNDSTRING"
+                echo "Error: expected: $EXPECTEDSTRING; found: $FOUNDSTRING"
                 return 1
         fi
         echo "Success:mkfsoptions for ost written to xml file correctly."
@@ -488,8 +523,12 @@ test_14() {
         start_ost
         start_mds
         mount_client $MOUNT || return $?
+        if [ -z "`dumpe2fs -h $OSTDEV | grep label_conf_15`" ]; then
+                echo "Error: the mkoptions not applied to mke2fs of ost."
+                return 1
+        fi
         cleanup
-        echo "lconf mkfsoptions-parsing for ost success"
+        echo "lconf mkfsoptions for ost success"
 
         gen_config
 }
index 193a062..56d3d04 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 LIBLUSTRE_MOUNT_POINT=${LIBLUSTRE_MOUNT_POINT:-"/mnt/lustre"}
-LIBLUSTRE_MOUNT_TARGET=${LIBLUSTRE_MOUNT_TARGET:-""}
+LIBLUSTRE_MOUNT_TARGET=${LIBLUSTRE_MOUNT_TARGET:-"TARGET_NOT_SET"}
 LIBLUSTRE_DUMPFILE=${LIBLUSTRE_DUMPFILE:-"/tmp/DUMP_FILE"}
 LD_PRELOAD=${LD_PRELOAD:-"/usr/lib/liblustre.so"}
 
index 4b1b65f..c245ff3 100644 (file)
@@ -14,5 +14,9 @@ int main()
 {
        lustre_assert_wire_constants();
 
+       if (ret == 0)
+               printf("wire constants OK\n");
+
        return ret;
 }
+