Whamcloud - gitweb
merge HEAD to b_eq: tag 20031230
authorericm <ericm>
Tue, 30 Dec 2003 08:25:50 +0000 (08:25 +0000)
committerericm <ericm>
Tue, 30 Dec 2003 08:25:50 +0000 (08:25 +0000)
19 files changed:
lnet/include/linux/kp30.h
lnet/klnds/socklnd/socklnd_cb.c
lnet/lnet/api-init.c
lnet/utils/debug.c
lustre/kernel_patches/patches/ext3-xattr-ptr-arith-fix.patch
lustre/kernel_patches/patches/tcp-zero-copy-2.4.22-rh.patch
lustre/kernel_patches/series/vanilla-2.4.22
lustre/llite/special.c [deleted file]
lustre/obdclass/llog_ioctl.c
lustre/portals/include/linux/kp30.h
lustre/portals/knals/socknal/socknal_cb.c
lustre/portals/portals/api-init.c
lustre/portals/utils/debug.c
lustre/ptlrpc/llog_server.c
lustre/tests/cfg/local.sh
lustre/tests/filter_survey.sh
lustre/tests/insanity.sh
lustre/utils/lfs.c
lustre/utils/liblustreapi.c

index 7c3d824..3ea46d1 100644 (file)
@@ -71,6 +71,7 @@ extern unsigned int portal_cerror;
 #define D_HA        (1 << 19) /* recovery and failover */
 #define D_RPCTRACE  (1 << 20) /* for distributed debugging */
 #define D_VFSTRACE  (1 << 21)
+#define D_READA     (1 << 22) /* read-ahead */
 
 #ifdef __KERNEL__
 # include <linux/sched.h> /* THREAD_SIZE */
@@ -279,10 +280,6 @@ do {                                                                          \
 
 #define PORTAL_VMALLOC_SIZE        16384
 
-#ifndef GFP_MEMALLOC
-#define GFP_MEMALLOC 0
-#endif
-
 #define PORTAL_ALLOC_GFP(ptr, size, mask)                                 \
 do {                                                                      \
         LASSERT (!in_interrupt());                                        \
@@ -304,10 +301,10 @@ do {                                                                      \
 } while (0)
 
 #define PORTAL_ALLOC(ptr, size) \
-        PORTAL_ALLOC_GFP(ptr, size, (GFP_KERNEL | GFP_MEMALLOC))
+        PORTAL_ALLOC_GFP(ptr, size, GFP_NOFS)
 
 #define PORTAL_ALLOC_ATOMIC(ptr, size) \
-        PORTAL_ALLOC_GFP(ptr, size, (GFP_ATOMIC | GFP_MEMALLOC))
+        PORTAL_ALLOC_GFP(ptr, size, GFP_ATOMIC)
 
 #define PORTAL_FREE(ptr, size)                                          \
 do {                                                                    \
index dca9818..f873864 100644 (file)
@@ -1672,8 +1672,6 @@ int ksocknal_scheduler (void *arg)
         kportal_daemonize (name);
         kportal_blockallsigs ();
 
-        current->flags |= PF_MEMALLOC;
-
 #if (CONFIG_SMP && CPU_AFFINITY)
         if ((cpu_online_map & (1 << id)) != 0) {
 #if 1
@@ -2132,7 +2130,7 @@ ksocknal_setup_sock (struct socket *sock)
         int             option;
         struct linger   linger;
 
-        sock->sk->allocation = GFP_MEMALLOC;
+        sock->sk->allocation = GFP_NOFS;
 
         /* Ensure this socket aborts active sends immediately when we close
          * it. */
@@ -2417,8 +2415,6 @@ ksocknal_autoconnectd (void *arg)
         kportal_daemonize (name);
         kportal_blockallsigs ();
 
-        current->flags |= PF_MEMALLOC;
-
         spin_lock_irqsave (&ksocknal_data.ksnd_autoconnectd_lock, flags);
 
         while (!ksocknal_data.ksnd_shuttingdown) {
@@ -2550,8 +2546,6 @@ ksocknal_reaper (void *arg)
         INIT_LIST_HEAD(&enomem_conns);
         init_waitqueue_entry (&wait, current);
 
-        current->flags |= PF_MEMALLOC;
-
         spin_lock_irqsave (&ksocknal_data.ksnd_reaper_lock, flags);
 
         while (!ksocknal_data.ksnd_shuttingdown) {
index 020a2a9..b811391 100644 (file)
 #include <portals/api-support.h>
 
 int ptl_init;
-unsigned int portal_subsystem_debug = ~0 - (S_PORTALS | S_QSWNAL | S_SOCKNAL | S_GMNAL | S_IBNAL);
-unsigned int portal_debug = ~0;
+unsigned int portal_subsystem_debug = ~0 - (S_PORTALS | S_QSWNAL | S_SOCKNAL |
+                                            S_GMNAL | S_IBNAL);
+unsigned int portal_debug = (D_WARNING | D_DLMTRACE | D_ERROR | D_EMERG | D_HA |
+                             D_RPCTRACE | D_VFSTRACE);
 unsigned int portal_cerror = 1;
 unsigned int portal_printk;
 unsigned int portal_stack;
index 3f3e69c..14750d8 100644 (file)
@@ -69,7 +69,7 @@ static const char *portal_debug_masks[] =
         {"trace", "inode", "super", "ext2", "malloc", "cache", "info", "ioctl",
          "blocks", "net", "warning", "buffs", "other", "dentry", "portals",
          "page", "dlmtrace", "error", "emerg", "ha", "rpctrace", "vfstrace",
-         NULL};
+         "reada", NULL};
 
 struct debug_daemon_cmd {
         char *cmd;
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 65baef5..edcb7c7 100644 (file)
@@ -5,9 +5,11 @@
  net/netsyms.c          |    2 
  5 files changed, 311 insertions(+), 3 deletions(-)
 
---- linux-2.4.22-ac1/include/linux/skbuff.h~tcp-zero-copy-2.4.22-rh    2003-08-25 15:44:44.000000000 +0400
-+++ linux-2.4.22-ac1-alexey/include/linux/skbuff.h     2003-09-26 00:38:48.000000000 +0400
-@@ -116,6 +116,30 @@ struct skb_frag_struct
+Index: linux-2.4.22-vanilla/include/linux/skbuff.h
+===================================================================
+--- linux-2.4.22-vanilla.orig/include/linux/skbuff.h   2003-11-03 23:22:13.000000000 +0300
++++ linux-2.4.22-vanilla/include/linux/skbuff.h        2003-12-02 23:56:35.000000000 +0300
+@@ -116,6 +116,30 @@
        __u16 size;
  };
  
@@ -38,7 +40,7 @@
  /* This data is invariant across clones and lives at
   * the end of the header data, ie. at skb->end.
   */
-@@ -123,6 +147,12 @@ struct skb_shared_info {
+@@ -123,6 +147,12 @@
        atomic_t        dataref;
        unsigned int    nr_frags;
        struct sk_buff  *frag_list;
        skb_frag_t      frags[MAX_SKB_FRAGS];
  };
  
---- linux-2.4.22-ac1/include/net/tcp.h~tcp-zero-copy-2.4.22-rh 2003-08-25 15:44:44.000000000 +0400
-+++ linux-2.4.22-ac1-alexey/include/net/tcp.h  2003-09-26 00:38:48.000000000 +0400
-@@ -643,6 +643,8 @@ extern int                 tcp_v4_tw_remember_stam
+Index: linux-2.4.22-vanilla/include/net/tcp.h
+===================================================================
+--- linux-2.4.22-vanilla.orig/include/net/tcp.h        2003-11-03 23:22:13.000000000 +0300
++++ linux-2.4.22-vanilla/include/net/tcp.h     2003-12-02 23:58:10.000000000 +0300
+@@ -643,6 +643,8 @@
  
  extern int                    tcp_sendmsg(struct sock *sk, struct msghdr *msg, int size);
  extern ssize_t                        tcp_sendpage(struct socket *sock, struct page *page, int offset, size_t size, int flags);
@@ -62,7 +66,7 @@
  
  extern int                    tcp_ioctl(struct sock *sk, 
                                          int cmd, 
-@@ -737,6 +739,9 @@ extern int                 tcp_recvmsg(struct sock *sk
+@@ -737,6 +739,9 @@
                                            struct msghdr *msg,
                                            int len, int nonblock, 
                                            int flags, int *addr_len);
  
  extern int                    tcp_listen_start(struct sock *sk);
  
---- linux-2.4.22-ac1/net/core/skbuff.c~tcp-zero-copy-2.4.22-rh 2003-08-25 15:44:44.000000000 +0400
-+++ linux-2.4.22-ac1-alexey/net/core/skbuff.c  2003-09-26 00:38:48.000000000 +0400
-@@ -208,6 +208,8 @@ struct sk_buff *alloc_skb(unsigned int s
+Index: linux-2.4.22-vanilla/net/core/skbuff.c
+===================================================================
+--- linux-2.4.22-vanilla.orig/net/core/skbuff.c        2003-11-03 23:22:13.000000000 +0300
++++ linux-2.4.22-vanilla/net/core/skbuff.c     2003-12-02 23:56:15.000000000 +0300
+@@ -208,6 +208,8 @@
        atomic_set(&(skb_shinfo(skb)->dataref), 1);
        skb_shinfo(skb)->nr_frags = 0;
        skb_shinfo(skb)->frag_list = NULL;
@@ -83,7 +89,7 @@
        return skb;
  
  nodata:
-@@ -277,6 +279,10 @@ static void skb_release_data(struct sk_b
+@@ -277,6 +279,10 @@
  {
        if (!skb->cloned ||
            atomic_dec_and_test(&(skb_shinfo(skb)->dataref))) {
                if (skb_shinfo(skb)->nr_frags) {
                        int i;
                        for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
-@@ -535,6 +541,8 @@ int skb_linearize(struct sk_buff *skb, i
+@@ -535,6 +541,8 @@
        atomic_set(&(skb_shinfo(skb)->dataref), 1);
        skb_shinfo(skb)->nr_frags = 0;
        skb_shinfo(skb)->frag_list = NULL;
  
        /* We are no longer a clone, even if we were. */
        skb->cloned = 0;
-@@ -581,6 +589,14 @@ struct sk_buff *pskb_copy(struct sk_buff
+@@ -581,6 +589,14 @@
        n->data_len = skb->data_len;
        n->len = skb->len;
  
        if (skb_shinfo(skb)->nr_frags) {
                int i;
  
-@@ -623,6 +639,8 @@ int pskb_expand_head(struct sk_buff *skb
+@@ -623,6 +639,8 @@
        u8 *data;
        int size = nhead + (skb->end - skb->head) + ntail;
        long off;
  
        if (skb_shared(skb))
                BUG();
-@@ -644,6 +662,11 @@ int pskb_expand_head(struct sk_buff *skb
+@@ -644,6 +662,11 @@
        if (skb_shinfo(skb)->frag_list)
                skb_clone_fraglist(skb);
  
        skb_release_data(skb);
  
        off = (data+nhead) - skb->head;
-@@ -658,6 +681,8 @@ int pskb_expand_head(struct sk_buff *skb
+@@ -658,6 +681,8 @@
        skb->nh.raw += off;
        skb->cloned = 0;
        atomic_set(&skb_shinfo(skb)->dataref, 1);
        return 0;
  
  nodata:
---- linux-2.4.22-ac1/net/ipv4/tcp.c~tcp-zero-copy-2.4.22-rh    2003-08-25 15:44:44.000000000 +0400
-+++ linux-2.4.22-ac1-alexey/net/ipv4/tcp.c     2003-09-26 00:38:48.000000000 +0400
-@@ -747,7 +747,7 @@ do_interrupted:
+Index: linux-2.4.22-vanilla/net/ipv4/tcp.c
+===================================================================
+--- linux-2.4.22-vanilla.orig/net/ipv4/tcp.c   2003-11-03 23:22:13.000000000 +0300
++++ linux-2.4.22-vanilla/net/ipv4/tcp.c        2003-12-02 23:56:15.000000000 +0300
+@@ -747,7 +747,7 @@
        goto out;
  }
  
  
  static inline int
  can_coalesce(struct sk_buff *skb, int i, struct page *page, int off)
-@@ -826,7 +826,8 @@ static int tcp_error(struct sock *sk, in
+@@ -826,7 +826,8 @@
        return err;
  }
  
  {
        struct tcp_opt *tp = &(sk->tp_pinfo.af_tcp);
        int mss_now;
-@@ -874,6 +875,17 @@ new_segment:
+@@ -874,6 +875,17 @@
                        copy = size;
  
                i = skb_shinfo(skb)->nr_frags;
                if (can_coalesce(skb, i, page, offset)) {
                        skb_shinfo(skb)->frags[i-1].size += copy;
                } else if (i < MAX_SKB_FRAGS) {
-@@ -884,6 +896,20 @@ new_segment:
+@@ -884,6 +896,20 @@
                        goto new_segment;
                }
  
                skb->len += copy;
                skb->data_len += copy;
                skb->ip_summed = CHECKSUM_HW;
-@@ -947,7 +973,31 @@ ssize_t tcp_sendpage(struct socket *sock
+@@ -947,7 +973,31 @@
  
        lock_sock(sk);
        TCP_CHECK_TIMER(sk);
        TCP_CHECK_TIMER(sk);
        release_sock(sk);
        return res;
-@@ -1771,6 +1821,202 @@ recv_urg:
+@@ -1771,6 +1821,202 @@
        goto out;
  }
  
  /*
   *    State processing on a close. This implements the state shift for
   *    sending our FIN frame. Note that we only send a FIN for some
---- linux-2.4.22-ac1/net/netsyms.c~tcp-zero-copy-2.4.22-rh     2003-09-25 14:16:26.000000000 +0400
-+++ linux-2.4.22-ac1-alexey/net/netsyms.c      2003-09-26 00:39:16.000000000 +0400
-@@ -396,6 +396,8 @@ EXPORT_SYMBOL(sysctl_tcp_wmem);
- EXPORT_SYMBOL(sysctl_tcp_ecn);
- EXPORT_SYMBOL(tcp_cwnd_application_limited);
- EXPORT_SYMBOL(tcp_sendpage);
+Index: linux-2.4.22-vanilla/net/netsyms.c
+===================================================================
+--- linux-2.4.22-vanilla.orig/net/netsyms.c    2003-11-03 23:22:13.000000000 +0300
++++ linux-2.4.22-vanilla/net/netsyms.c 2003-12-04 20:42:50.000000000 +0300
+@@ -417,6 +417,8 @@
+ #endif
 +EXPORT_SYMBOL(tcp_sendpage_zccd);
 +EXPORT_SYMBOL(tcp_recvpackets);
- EXPORT_SYMBOL(sysctl_tcp_low_latency);
+ EXPORT_SYMBOL(tcp_read_sock);
  
- EXPORT_SYMBOL(tcp_write_xmit);
-
-_
+ EXPORT_SYMBOL(netlink_set_err);
index 1e91487..47b40fa 100644 (file)
@@ -30,3 +30,4 @@ ext3-trusted_ea-2.4.20.patch
 kernel_text_address-2.4.22-vanilla.patch
 gfp_memalloc-2.4.22.patch
 ext3-xattr-ptr-arith-fix.patch
+3.5G-address-space-2.4.22-vanilla.patch 
diff --git a/lustre/llite/special.c b/lustre/llite/special.c
deleted file mode 100644 (file)
index aeb281b..0000000
+++ /dev/null
@@ -1,365 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *  Copyright (c) 2002, 2003 Cluster File Systems, Inc.
- *   Author: Peter Braam <braam@clusterfs.com>
- *   Author: Phil Schwan <phil@clusterfs.com>
- *   Author: Andreas Dilger <adilger@clusterfs.com>
- *
- *   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 DEBUG_SUBSYSTEM S_LLITE
-#include <linux/lustre_lite.h>
-#include <linux/file.h>
-#include <asm/poll.h>
-#include "llite_internal.h"
-
-#define FILE_OPS 0 
-#define INODE_OPS 1 
-
-static inline struct file_operations** 
-get_save_fops(struct file* filp, int mode)
-{
-        struct inode *inode = filp->f_dentry->d_inode;
-        struct ll_inode_info *lli = ll_i2info(inode);
-        if (mode == FILE_OPS){
-                if (S_ISFIFO(inode->i_mode)){
-                        switch (filp->f_mode) {
-                        case 1: /*O_RDONLY*/
-                                return &(lli->ll_save_ffop);
-                        case 2: /*O_WRONLY*/
-                                return &(lli->ll_save_wfop);
-                        case 3: /* O_RDWR */
-                                return &(lli->ll_save_wrfop);
-                        default:
-                                return NULL;
-                        }
-                }
-                return &(lli->ll_save_ffop);
-        } else
-                return &(lli->ll_save_ifop);
-
-}
-                                          
-
-static inline void save_fops(struct file *filp, struct inode *inode,
-                             struct file_operations *sfops) 
-{
-        struct ll_inode_info *lli = ll_i2info(inode);
-        
-        if (sfops != filp->f_op) {
-                struct file_operations** pfop = get_save_fops (filp, FILE_OPS);
-                
-                *pfop = filp->f_op;
-                if (S_ISCHR(inode->i_mode)) {
-                        filp->f_op = &ll_special_chr_file_fops;
-                }else if (S_ISFIFO(inode->i_mode)){
-                        filp->f_op = &ll_special_fifo_file_fops;
-                }
-                filp->f_op->owner = lli->ll_save_ffop->owner; 
-        }
-}
-
-static ssize_t ll_special_file_read(struct file *filp, char *buf, 
-                                    size_t count, loff_t *ppos)
-{
-        struct file_operations** pfop = get_save_fops (filp, FILE_OPS);
-        int    rc = -EINVAL;
-
-        if (pfop && *pfop && (*pfop)->read) 
-                rc = (*pfop)->read(filp, buf, count, ppos);
-        
-        RETURN(rc);
-}
-
-static ssize_t ll_special_file_write(struct file *filp, const char *buf, 
-                                     size_t count, loff_t *ppos)
-{
-        struct file_operations** pfop = get_save_fops (filp, FILE_OPS);
-        int    rc = -EINVAL;
-        
-        if (pfop && *pfop && (*pfop)->write) 
-                rc = (*pfop)->write(filp, buf, count, ppos);
-        
-        RETURN(rc);
-}
-static int ll_special_file_ioctl(struct inode *inode, struct file *filp, 
-                                 unsigned int cmd, unsigned long arg)
-{
-        struct file_operations** pfop = get_save_fops (filp, FILE_OPS);
-        int    rc = -ENOTTY;
-
-        if (pfop && *pfop && (*pfop)->ioctl) { 
-                struct file_operations *sfops = filp->f_op;
-                
-                rc = (*pfop)->ioctl(inode, filp, cmd, arg);
-                save_fops(filp, inode, sfops);
-        }
-        RETURN(rc);
-}
-
-static loff_t ll_special_file_seek(struct file *filp, loff_t offset, int origin)
-{
-        struct file_operations** pfop = get_save_fops (filp, FILE_OPS);
-        int    rc = 0;
-
-        if (pfop && *pfop && (*pfop)->llseek)  
-                rc = (*pfop)->llseek(filp, offset, origin);
-        else
-                rc = default_llseek(filp, offset, origin);
-       
-        RETURN(rc);
-}
-
-
-#define DEFAULT_POLLMASK (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM)
-
-static unsigned int
-ll_special_file_poll(struct file *filp, struct poll_table_struct *poll_table) 
-{
-        struct file_operations** pfop = get_save_fops (filp, FILE_OPS);
-        int    rc = DEFAULT_POLLMASK;
-
-        if (pfop && *pfop && (*pfop)->poll)  
-                rc = (*pfop)->poll(filp, poll_table);
-
-        RETURN(rc);
-}
-
-static int ll_special_file_open(struct inode *inode, struct file *filp)
-{
-        struct file_operations** pfop = get_save_fops (filp, FILE_OPS);
-        int rc = -EINVAL;
-
-        if (pfop && *pfop && (*pfop)->open)  
-                rc = (*pfop)->open(inode, filp);
-        
-        RETURN(rc);
-}
-
-static ssize_t ll_special_read(struct file *filp, char *buf, 
-                               size_t count, loff_t *ppos)
-{
-        struct file_operations** pfop = get_save_fops (filp, INODE_OPS);
-        int    rc = -EINVAL;
-
-        if (pfop && *pfop && (*pfop)->read)  
-                rc = (*pfop)->read(filp, buf, count, ppos);
-        
-        RETURN(rc);
-}
-
-static ssize_t ll_special_write(struct file *filp, const char *buf, 
-                                size_t count, loff_t *ppos)
-{
-        struct file_operations** pfop = get_save_fops (filp, INODE_OPS);
-        int    rc = -EINVAL;
-
-        if (pfop && *pfop && (*pfop)->write)  
-                rc = (*pfop)->write(filp, buf, count, ppos);
-        
-        RETURN(rc);
-}
-
-static int ll_special_ioctl(struct inode *inode, struct file *filp, 
-                            unsigned int cmd, unsigned long arg)
-{
-        struct file_operations** pfop = get_save_fops (filp, INODE_OPS);
-        int    rc = -ENOTTY;
-
-        if (pfop && *pfop && (*pfop)->ioctl) { 
-                struct file_operations *sfops = filp->f_op;
-                
-                rc = (*pfop)->ioctl(inode, filp, cmd, arg);
-                /* sometimes, file_operations will be changed in ioctl */
-                save_fops(filp, inode, sfops);
-        }
-
-        RETURN(rc);
-}
-
-static int ll_special_mmap(struct file * filp, struct vm_area_struct * vma)
-{
-        struct file_operations** pfop = get_save_fops (filp, INODE_OPS);
-        int    rc = -ENODEV;
-
-        if (pfop && *pfop && (*pfop)->mmap)  
-                rc = (*pfop)->mmap(filp, vma);
-        
-        RETURN(rc);
-}
-
-static loff_t ll_special_seek(struct file *filp, loff_t offset, int origin)
-{
-        struct file_operations** pfop = get_save_fops (filp, INODE_OPS);
-        int    rc = 0;
-
-        if (pfop && *pfop && (*pfop)->llseek)  
-                rc = (*pfop)->llseek(filp, offset, origin);
-        else
-                rc = default_llseek(filp, offset, origin);
-       
-        RETURN(rc);
-}
-
-static int ll_special_fsync(struct file *filp, struct dentry *dentry, int data)
-{
-        struct file_operations** pfop = get_save_fops (filp, INODE_OPS);
-        int    rc = -EINVAL;
-
-        if (pfop && *pfop && (*pfop)->fsync)  
-                rc = (*pfop)->fsync(filp, dentry, data);
-
-        RETURN(rc);
-}
-
-static int ll_special_file_fasync(int fd, struct file *filp, int on)
-{
-        struct file_operations** pfop = get_save_fops (filp, FILE_OPS);
-        int    rc = -EINVAL;
-
-        if (pfop && *pfop && (*pfop)->fasync)  
-                rc = (*pfop)->fasync(fd, filp, on);
-
-        RETURN(rc);
-}
-
-static int ll_special_open(struct inode *inode, struct file *filp)
-{
-        struct ptlrpc_request *req;
-        struct file_operations** pfop = get_save_fops (filp, INODE_OPS);
-        struct lookup_intent *it;
-        int rc = -EINVAL;
-        ENTRY;
-        
-        if (pfop && *pfop && (*pfop)->open) { 
-                struct file_operations *sfops = filp->f_op;
-                
-                rc = (*pfop)->open(inode, filp);
-                 /* sometimes the file_operations will be changed in open */
-                save_fops(filp, inode, sfops);
-        }
-        
-        lprocfs_counter_incr(ll_i2sbi(inode)->ll_stats, LPROC_LL_OPEN);
-        
-        it = filp->f_it;
-        
-        rc = ll_local_open(filp, it);
-        if (rc)
-                RETURN(rc);
-        req = it->d.lustre.it_data;
-        if (req)
-                ptlrpc_req_finished(req);
-        
-        RETURN(rc);
-}
-
-static int ll_special_release(struct inode *inode, struct file *filp)
-{
-       struct ll_sb_info *sbi = ll_i2sbi(inode);
-       struct file_operations** pfop = get_save_fops (filp, INODE_OPS);
-       int rc = 0, rc2 = 0;
-       ENTRY;
-
-        if (pfop && *pfop && (*pfop)->release) { 
-                rc = (*pfop)->release(inode, filp);
-        }
-        lprocfs_counter_incr(sbi->ll_stats, LPROC_LL_RELEASE);
-                
-        rc2 = ll_mdc_close(sbi->ll_mdc_exp, inode, filp);
-                
-        if (rc2 && !rc)
-                rc = rc2;
-        
-        RETURN(rc);
-}
-
-static int ll_special_file_release(struct inode *inode, struct file *filp)
-{
-        struct ll_sb_info *sbi = ll_i2sbi(inode);
-        struct file_operations** pfop = get_save_fops (filp, FILE_OPS);
-        int rc = 0, rc2 = 0;
-        ENTRY;
-
-        if (pfop && *pfop && (*pfop)->release) { 
-                rc = (*pfop)->release(inode, filp);
-        }
-        lprocfs_counter_incr(sbi->ll_stats, LPROC_LL_RELEASE);
-                
-        rc2 = ll_mdc_close(sbi->ll_mdc_exp, inode, filp);
-                
-        if (rc2 && !rc)
-               rc = rc2;
-
-        RETURN(rc);
-
-}
-
-struct inode_operations ll_special_inode_operations = {
-        setattr_raw:    ll_setattr_raw,
-        setattr:        ll_setattr,
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
-        getattr_it:     ll_getattr,
-#else
-        revalidate_it:  ll_inode_revalidate_it,
-#endif
-};
-
-struct file_operations ll_special_chr_inode_fops = {
-       open:           ll_special_open,
-};
-
-struct file_operations ll_special_blk_inode_fops = {
-        read:           ll_special_read,
-        write:          ll_special_write,
-        ioctl:          ll_special_ioctl,
-        open:           ll_special_open,
-        release:        ll_special_release,
-        mmap:           ll_special_mmap,
-        llseek:         ll_special_seek,
-        fsync:          ll_special_fsync,
-};
-
-struct file_operations ll_special_fifo_inode_fops = {
-        open:           ll_special_open,      
-};
-
-struct file_operations ll_special_sock_inode_fops = {
-        open:           ll_special_open
-};
-
-struct file_operations ll_special_chr_file_fops = {
-       llseek:         ll_special_file_seek,
-       read:           ll_special_file_read,
-       write:          ll_special_file_write,
-       poll:           ll_special_file_poll,
-       ioctl:          ll_special_file_ioctl,
-       open:           ll_special_file_open,
-       release:        ll_special_file_release,
-       fasync:         ll_special_file_fasync,
-};
-
-struct file_operations ll_special_fifo_file_fops = {
-       llseek:         ll_special_file_seek,
-       read:           ll_special_file_read,
-       write:          ll_special_file_write,
-       poll:           ll_special_file_poll,
-       ioctl:          ll_special_file_ioctl,
-       open:           ll_special_file_open,
-       release:        ll_special_file_release,
-};
-
index 03279f8..3a6fb7d 100644 (file)
@@ -60,6 +60,89 @@ static int str2logid(struct llog_logid *logid, char *str, int len)
         RETURN(0);
 }
 
+static int llog_check_cb(struct llog_handle *handle, struct llog_rec_hdr *rec, 
+                         void *data)
+{
+        struct obd_ioctl_data *ioc_data = (struct obd_ioctl_data *)data;
+        static int l, remains, from, to;
+        static char *out;
+        char *endp;
+        int cur_index, rc = 0;
+        
+        cur_index = le32_to_cpu(rec->lrh_index);
+        
+        if (ioc_data && (ioc_data->ioc_inllen1)) {
+                l = 0;
+                remains = ioc_data->ioc_inllen4 + 
+                        size_round(ioc_data->ioc_inllen1) +
+                        size_round(ioc_data->ioc_inllen2) +
+                        size_round(ioc_data->ioc_inllen3);
+                from = simple_strtol(ioc_data->ioc_inlbuf2, &endp, 0);
+                if (*endp != '\0')
+                        RETURN(-EINVAL);
+                to = simple_strtol(ioc_data->ioc_inlbuf3, &endp, 0);
+                if (*endp != '\0')
+                        RETURN(-EINVAL);
+                ioc_data->ioc_inllen1 = 0;
+                out = ioc_data->ioc_bulk;
+                if (cur_index < from)
+                        RETURN(0);
+                if (to > 0 && cur_index > to)
+                        RETURN(-LLOG_EEMPTY);
+        }
+        if (handle->lgh_hdr->llh_flags & cpu_to_le32(LLOG_F_IS_CAT)) {
+                struct llog_logid_rec *lir = (struct llog_logid_rec *)rec;
+                struct llog_handle *log_handle; 
+                
+                if (rec->lrh_type != cpu_to_le32(LLOG_LOGID_MAGIC)) { 
+                        l = snprintf(out, remains,
+                                     "[index]: %05d  [type]: %02x  [len]: %04d failed\n", 
+                                     cur_index, le32_to_cpu(rec->lrh_type),
+                                     le32_to_cpu(rec->lrh_len));
+                }
+                if (handle->lgh_ctxt == NULL)
+                        RETURN(-EOPNOTSUPP);
+                llog_cat_id2handle(handle, &log_handle, &lir->lid_id);
+                rc = llog_process(log_handle, llog_check_cb, NULL); 
+                llog_close(log_handle);
+        } else {
+                switch (le32_to_cpu(rec->lrh_type)) {
+                case OST_SZ_REC:
+                case OST_RAID1_REC:    
+                case MDS_UNLINK_REC:
+                case OBD_CFG_REC:      
+                case PTL_CFG_REC:      
+                case LLOG_HDR_MAGIC: { 
+                         l = snprintf(out, remains,
+                                     "[index]: %05d  [type]: %02x  [len]: %04d ok\n", 
+                                     cur_index, le32_to_cpu(rec->lrh_type),
+                                     le32_to_cpu(rec->lrh_len));
+                         out += l;
+                         remains -= l;
+                         if (remains <= 0) {
+                                CERROR("not enough space for print log records\n");
+                                RETURN(-LLOG_EEMPTY);
+                         }
+                         RETURN(0);
+                }
+                default: {
+                         l = snprintf(out, remains,
+                                     "[index]: %05d  [type]: %02x  [len]: %04d failed\n", 
+                                     cur_index, le32_to_cpu(rec->lrh_type),
+                                     le32_to_cpu(rec->lrh_len));
+                         out += l;
+                         remains -= l;
+                         if (remains <= 0) {
+                                CERROR("not enough space for print log records\n");
+                                RETURN(-LLOG_EEMPTY);
+                         }
+                         RETURN(0);
+                } 
+                }
+        }
+        RETURN(rc);
+}
+
 static int llog_print_cb(struct llog_handle *handle, struct llog_rec_hdr *rec, 
                          void *data)
 {
@@ -91,9 +174,9 @@ static int llog_print_cb(struct llog_handle *handle, struct llog_rec_hdr *rec,
         if (to > 0 && cur_index > to)
                 RETURN(-LLOG_EEMPTY);
 
-        if (le32_to_cpu(handle->lgh_hdr->llh_flags) & LLOG_F_IS_CAT) {
+        if (handle->lgh_hdr->llh_flags & cpu_to_le32(LLOG_F_IS_CAT)) {
                 struct llog_logid_rec *lir = (struct llog_logid_rec *)rec;
-                if (le32_to_cpu(rec->lrh_type) != LLOG_LOGID_MAGIC) {
+                if (rec->lrh_type != cpu_to_le32(LLOG_LOGID_MAGIC)) {
                         CERROR("invalid record in catalog\n");
                         RETURN(-EINVAL);
                 }
@@ -117,7 +200,6 @@ static int llog_print_cb(struct llog_handle *handle, struct llog_rec_hdr *rec,
 
         RETURN(0);
 }
-
 static int llog_remove_log(struct llog_handle *cat, struct llog_logid *logid)
 {
         struct llog_handle *log;
@@ -140,10 +222,24 @@ static int llog_remove_log(struct llog_handle *cat, struct llog_logid *logid)
         }
         rc = llog_cancel_rec(cat, index);
 out:
+        llog_free_handle(log);
         up_write(&cat->lgh_lock);
         RETURN(rc);
 
 }
+static int llog_delete_cb(struct llog_handle *handle, struct llog_rec_hdr *rec, 
+                         void *data)
+{
+        struct  llog_logid_rec *lir = (struct llog_logid_rec*)rec;
+        int     rc;
+        
+        if (rec->lrh_type != cpu_to_le32(LLOG_LOGID_MAGIC))
+              return (-EINVAL); 
+        rc = llog_remove_log(handle, &lir->lid_id);
+        
+        RETURN(rc);
+}
+
 
 int llog_ioctl(struct llog_ctxt *ctxt, int cmd, struct obd_ioctl_data *data)
 {
@@ -197,6 +293,14 @@ int llog_ioctl(struct llog_ctxt *ctxt, int cmd, struct obd_ioctl_data *data)
 
                 GOTO(out_close, err);
         }
+        case OBD_IOC_LLOG_CHECK: {
+                LASSERT(data->ioc_inllen1);
+                err = llog_process(handle, llog_check_cb, data);
+                if (err == -LLOG_EEMPTY)
+                        err = 0;
+                GOTO(out_close, err);
+        }
+
         case OBD_IOC_LLOG_PRINT: {
                 LASSERT(data->ioc_inllen1);
                 err = llog_process(handle, llog_print_cb, data);
@@ -210,7 +314,7 @@ int llog_ioctl(struct llog_ctxt *ctxt, int cmd, struct obd_ioctl_data *data)
                 struct llog_logid plain;
                 char *endp;
                 
-                if (!le32_to_cpu(handle->lgh_hdr->llh_flags) & LLOG_F_IS_CAT)
+                if (!(handle->lgh_hdr->llh_flags & cpu_to_le32(LLOG_F_IS_CAT)))
                         GOTO(out_close, err = -EINVAL);
         
                 err = str2logid(&plain, data->ioc_inlbuf2, data->ioc_inllen2);
@@ -228,20 +332,26 @@ int llog_ioctl(struct llog_ctxt *ctxt, int cmd, struct obd_ioctl_data *data)
         case OBD_IOC_LLOG_REMOVE: {
                 struct llog_logid plain;
                 
-                if (!le32_to_cpu(handle->lgh_hdr->llh_flags) & LLOG_F_IS_CAT)
+                if (!(handle->lgh_hdr->llh_flags & cpu_to_le32(LLOG_F_IS_CAT)))
                         GOTO(out_close, err = -EINVAL);
         
-                err = str2logid(&plain, data->ioc_inlbuf2, data->ioc_inllen2);
-                if (err)
-                        GOTO(out_close, err);
-                err = llog_remove_log(handle, &plain);
+                if (data->ioc_inlbuf2) {
+                        /*remove indicate log from the catalog*/
+                        err = str2logid(&plain, data->ioc_inlbuf2, data->ioc_inllen2);
+                        if (err)
+                                GOTO(out_close, err);
+                        err = llog_remove_log(handle, &plain);
+                } else {
+                        /*remove all the log of the catalog*/
+                        llog_process(handle, llog_delete_cb, NULL);
+                }
                 GOTO(out_close, err);
         }
         }
         
 out_close:
         if (handle->lgh_hdr && 
-            le32_to_cpu(handle->lgh_hdr->llh_flags) & LLOG_F_IS_CAT)
+            handle->lgh_hdr->llh_flags & cpu_to_le32(LLOG_F_IS_CAT))
                 llog_cat_put(handle);
         else
                 llog_close(handle);
index 7c3d824..3ea46d1 100644 (file)
@@ -71,6 +71,7 @@ extern unsigned int portal_cerror;
 #define D_HA        (1 << 19) /* recovery and failover */
 #define D_RPCTRACE  (1 << 20) /* for distributed debugging */
 #define D_VFSTRACE  (1 << 21)
+#define D_READA     (1 << 22) /* read-ahead */
 
 #ifdef __KERNEL__
 # include <linux/sched.h> /* THREAD_SIZE */
@@ -279,10 +280,6 @@ do {                                                                          \
 
 #define PORTAL_VMALLOC_SIZE        16384
 
-#ifndef GFP_MEMALLOC
-#define GFP_MEMALLOC 0
-#endif
-
 #define PORTAL_ALLOC_GFP(ptr, size, mask)                                 \
 do {                                                                      \
         LASSERT (!in_interrupt());                                        \
@@ -304,10 +301,10 @@ do {                                                                      \
 } while (0)
 
 #define PORTAL_ALLOC(ptr, size) \
-        PORTAL_ALLOC_GFP(ptr, size, (GFP_KERNEL | GFP_MEMALLOC))
+        PORTAL_ALLOC_GFP(ptr, size, GFP_NOFS)
 
 #define PORTAL_ALLOC_ATOMIC(ptr, size) \
-        PORTAL_ALLOC_GFP(ptr, size, (GFP_ATOMIC | GFP_MEMALLOC))
+        PORTAL_ALLOC_GFP(ptr, size, GFP_ATOMIC)
 
 #define PORTAL_FREE(ptr, size)                                          \
 do {                                                                    \
index dca9818..f873864 100644 (file)
@@ -1672,8 +1672,6 @@ int ksocknal_scheduler (void *arg)
         kportal_daemonize (name);
         kportal_blockallsigs ();
 
-        current->flags |= PF_MEMALLOC;
-
 #if (CONFIG_SMP && CPU_AFFINITY)
         if ((cpu_online_map & (1 << id)) != 0) {
 #if 1
@@ -2132,7 +2130,7 @@ ksocknal_setup_sock (struct socket *sock)
         int             option;
         struct linger   linger;
 
-        sock->sk->allocation = GFP_MEMALLOC;
+        sock->sk->allocation = GFP_NOFS;
 
         /* Ensure this socket aborts active sends immediately when we close
          * it. */
@@ -2417,8 +2415,6 @@ ksocknal_autoconnectd (void *arg)
         kportal_daemonize (name);
         kportal_blockallsigs ();
 
-        current->flags |= PF_MEMALLOC;
-
         spin_lock_irqsave (&ksocknal_data.ksnd_autoconnectd_lock, flags);
 
         while (!ksocknal_data.ksnd_shuttingdown) {
@@ -2550,8 +2546,6 @@ ksocknal_reaper (void *arg)
         INIT_LIST_HEAD(&enomem_conns);
         init_waitqueue_entry (&wait, current);
 
-        current->flags |= PF_MEMALLOC;
-
         spin_lock_irqsave (&ksocknal_data.ksnd_reaper_lock, flags);
 
         while (!ksocknal_data.ksnd_shuttingdown) {
index 020a2a9..b811391 100644 (file)
 #include <portals/api-support.h>
 
 int ptl_init;
-unsigned int portal_subsystem_debug = ~0 - (S_PORTALS | S_QSWNAL | S_SOCKNAL | S_GMNAL | S_IBNAL);
-unsigned int portal_debug = ~0;
+unsigned int portal_subsystem_debug = ~0 - (S_PORTALS | S_QSWNAL | S_SOCKNAL |
+                                            S_GMNAL | S_IBNAL);
+unsigned int portal_debug = (D_WARNING | D_DLMTRACE | D_ERROR | D_EMERG | D_HA |
+                             D_RPCTRACE | D_VFSTRACE);
 unsigned int portal_cerror = 1;
 unsigned int portal_printk;
 unsigned int portal_stack;
index 3f3e69c..14750d8 100644 (file)
@@ -69,7 +69,7 @@ static const char *portal_debug_masks[] =
         {"trace", "inode", "super", "ext2", "malloc", "cache", "info", "ioctl",
          "blocks", "net", "warning", "buffs", "other", "dentry", "portals",
          "page", "dlmtrace", "error", "emerg", "ha", "rpctrace", "vfstrace",
-         NULL};
+         "reada", NULL};
 
 struct debug_daemon_cmd {
         char *cmd;
index 742b545..645a32e 100644 (file)
@@ -281,3 +281,230 @@ int llog_origin_handle_cancel(struct ptlrpc_request *req)
 }
 EXPORT_SYMBOL(llog_origin_handle_cancel);
 #endif
+
+static int llog_catinfo_config(struct obd_device *obd, char *buf, int buf_len, 
+                               char *client)
+{
+        struct mds_obd *mds = &obd->u.mds;
+        struct llog_ctxt *ctxt = llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT);
+        struct obd_run_ctxt saved;
+        struct llog_handle *handle = NULL;
+        char name[4][64];
+        int rc, i, l, remains = buf_len;
+        char *out = buf;
+        
+        if (ctxt == NULL || mds == NULL)
+                RETURN(-EOPNOTSUPP);
+
+        push_ctxt(&saved, &ctxt->loc_exp->exp_obd->obd_ctxt, NULL);
+        
+        sprintf(name[0], "%s", mds->mds_profile);
+        sprintf(name[1], "%s-clean", mds->mds_profile);
+        sprintf(name[2], "%s", client);
+        sprintf(name[3], "%s-clean", client);
+        
+        for (i = 0; i < 4; i++) {
+                int index, uncanceled = 0;
+                rc = llog_create(ctxt, &handle, NULL, name[i]);
+                if (rc)
+                        GOTO(out_pop, rc);
+                rc = llog_init_handle(handle, 0, NULL);
+                if (rc) {
+                        llog_close(handle);
+                        GOTO(out_pop, rc = -ENOENT);
+                }
+                
+                for (index = 1; index < (LLOG_BITMAP_BYTES * 8); index ++) {
+                        if (ext2_test_bit(index, handle->lgh_hdr->llh_bitmap))
+                                uncanceled++;
+                }
+                
+                l = snprintf(out, remains, "[Log Name]: %s\nLog Size: "LPD64"\n"
+                             "Last Index: %d\nUncanceled Records: %d\n\n",
+                             name[i], 
+                             handle->lgh_file->f_dentry->d_inode->i_size,
+                             handle->lgh_last_idx,
+                             uncanceled);
+                out += l;
+                remains -= l;
+
+                llog_close(handle);
+                if (remains <= 0)
+                        break;
+        }
+out_pop:
+        pop_ctxt(&saved, &ctxt->loc_exp->exp_obd->obd_ctxt, NULL);
+        RETURN(rc);
+}
+
+struct cb_data {
+        struct llog_ctxt *ctxt;
+        char *out;
+        int  remains;
+        int  init;
+};
+
+static int llog_catinfo_cb(struct llog_handle *cat, 
+                           struct llog_rec_hdr *rec, void *data)
+{
+        static char *out = NULL;
+        static int remains = 0;
+        struct llog_ctxt *ctxt;
+        struct llog_handle *handle;
+        struct llog_logid *logid;
+        struct llog_logid_rec *lir;
+        int l, rc, index, count = 0;
+        struct cb_data *cbd = (struct cb_data*)data;
+
+        if (cbd->init) {
+                out = cbd->out;
+                remains = cbd->remains;
+                cbd->init = 0;
+        }
+        ctxt = cbd->ctxt;
+
+        if (!(cat->lgh_hdr->llh_flags & cpu_to_le32(LLOG_F_IS_CAT)))
+                RETURN(-EINVAL);
+        
+        lir = (struct llog_logid_rec *)rec;
+        logid = &lir->lid_id;
+        rc = llog_create(ctxt, &handle, logid, NULL);
+        if (rc)
+                RETURN(-EINVAL);
+        rc = llog_init_handle(handle, 0, NULL);
+        if (rc)
+                GOTO(out_close, rc);
+        
+        for (index = 1; index < (LLOG_BITMAP_BYTES * 8); index++) {
+                if (ext2_test_bit(index, handle->lgh_hdr->llh_bitmap))
+                        count++;
+        }
+
+        l = snprintf(out, remains, "\t[Log ID]: #"LPX64"#"LPX64"#%08x\n"
+                     "\tLog Size: "LPD64"\n\tLast Index: %d\n"
+                     "\tUncanceled Records: %d\n",
+                     logid->lgl_oid, logid->lgl_ogr, logid->lgl_ogen,
+                     handle->lgh_file->f_dentry->d_inode->i_size,
+                     handle->lgh_last_idx, count);
+        out += l;
+        remains -= l;
+        cbd->out = out;
+        cbd->remains = remains;
+        if (remains <= 0) {
+                CWARN("Not enough memory\n");
+                rc = -ENOMEM;
+        }
+        
+out_close:
+        llog_close(handle);
+        RETURN(rc);
+}
+                
+static int llog_catinfo_deletions(struct obd_device *obd, char *buf, 
+                                  int buf_len)
+{
+        struct mds_obd *mds = &obd->u.mds;
+        struct llog_handle *handle;
+        struct obd_run_ctxt saved;
+        int size, i, count;
+        struct llog_logid *idarray, *id;
+        char name[32] = "CATLIST";
+        int rc;
+        struct cb_data data;
+        struct llog_ctxt *ctxt = llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT);
+        if (ctxt == NULL || mds == NULL)
+                RETURN(-EOPNOTSUPP);
+       
+        count = mds->mds_lov_desc.ld_tgt_count;
+        size = sizeof(*idarray) * count;
+        
+        OBD_ALLOC(idarray, size);
+        if (!idarray)
+                RETURN(-ENOMEM);
+        memset(idarray, 0, size);
+        
+        rc = llog_get_cat_list(obd, obd, name, count, idarray);
+        if (rc) 
+                GOTO(out_free, rc);
+
+        push_ctxt(&saved, &ctxt->loc_exp->exp_obd->obd_ctxt, NULL);
+        
+        id = idarray;
+        data.ctxt = ctxt;
+        data.out = buf;
+        data.remains = buf_len;
+        for (i = 0; i < count; i++) {
+                int l, index, uncanceled = 0;
+                rc = llog_create(ctxt, &handle, id, NULL);
+                if (rc)
+                        GOTO(out_pop, rc);
+                rc = llog_init_handle(handle, 0, NULL);
+                if (rc) {
+                        llog_close(handle);
+                        GOTO(out_pop, rc = -ENOENT);
+                }
+                for (index = 1; index < (LLOG_BITMAP_BYTES * 8); index++) {
+                        if (ext2_test_bit(index, handle->lgh_hdr->llh_bitmap))
+                                uncanceled++;
+                }
+                l = snprintf(data.out, data.remains, 
+                             "\n[Catlog ID]: #"LPX64"#"LPX64"#%08x  "
+                             "[Log Count]: %d\n",
+                             id->lgl_oid, id->lgl_ogr, id->lgl_ogen,
+                             uncanceled);
+                
+                data.out += l;
+                data.remains -= l;
+                data.init = 1;
+                
+                llog_process(handle, llog_catinfo_cb, &data);
+                llog_close(handle);
+                
+                if (data.remains <= 0)
+                        break;
+        }
+out_pop:
+        pop_ctxt(&saved, &ctxt->loc_exp->exp_obd->obd_ctxt, NULL);
+out_free:
+        OBD_FREE(idarray, size);
+        RETURN(rc);
+}
+        
+int llog_catinfo(struct ptlrpc_request *req)
+{
+        struct obd_export *exp = req->rq_export;
+        struct obd_device *obd = exp->exp_obd;
+        char *keyword;
+        char *buf, *reply;
+        int rc, buf_len = LLOG_CHUNK_SIZE;
+
+        OBD_ALLOC(buf, buf_len);
+        if (buf == NULL)
+                return -ENOMEM;
+        memset(buf, 0, buf_len);
+
+        keyword = lustre_msg_string(req->rq_reqmsg, 0, 0);
+
+        if (strcmp(keyword, "config") == 0) {
+                char *client = lustre_msg_string(req->rq_reqmsg, 1, 0);
+                rc = llog_catinfo_config(obd, buf, buf_len, client);
+        } else if (strcmp(keyword, "deletions") == 0) {
+                rc = llog_catinfo_deletions(obd, buf, buf_len);
+        } else {
+                rc = -EOPNOTSUPP;
+        }
+
+        rc = lustre_pack_reply(req, 1, &buf_len, NULL);
+        if (rc)
+                GOTO(out_free, rc = -ENOMEM);
+
+        reply = lustre_msg_buf(req->rq_repmsg, 0, buf_len);
+        if (strlen(buf) == 0)
+                sprintf(buf, "%s", "No log informations\n");
+        memcpy(reply, buf, buf_len);
+        
+out_free:
+        OBD_FREE(buf, buf_len);
+        return rc;
+}
index f9c5198..1e41cff 100644 (file)
@@ -1,12 +1,13 @@
 # oldstyle
 MDSNODE=${MDSNODE:-`hostname`}
 OSTNODE=${OSTNODE:-`hostname`}
+CLIENT=${CLIENT:-client}
 
 mds_HOST=${mds_HOST:-$MDSNODE}
 mdsfailover_HOST=${mdsfailover_HOST}
 ost_HOST=${ost_HOST:-$OSTNODE}
 ost2_HOST=${ost2_HOST:-$ost_HOST}
-client_HOST=${client_HOST:-"'*'"}
+client_HOST=${client_HOST:-$CLIENT}
 NETTYPE=${NETTYPE:-tcp}
 
 MOUNT=${MOUNT:-"/mnt/lustre"}
index bc1b82d..f2cd080 100644 (file)
@@ -14,7 +14,7 @@ export PATH=$SRCDIR/../utils:/sbin:/usr/sbin::$PATH
 
 tmp_dir=""
 echo_base="f_s_$$"
-echo_objs=""
+last_filter="-1"
 
 die() {
        echo $* 1>&2
@@ -23,12 +23,13 @@ die() {
 
 cleanup() {
        [ ! -z "$tmp_dir" ] && [ -d $tmp_dir ] && rm -rf $tmp_dir
-       [ -z "$echo_objs" ] && exit 0
-       for obj in $echo_objs; do
-               echo cleaning up $obj
+       [ "$last_filter" = "-1" ] && exit 0
+       for i in `seq 0 $last_filter`; do
+               local name="${echo_names[$i]}"
+               echo cleaning up $name
 # I can't believe leading whitespace matters here.
 lctl << EOF
-device $obj
+cfg_device $name
 cleanup
 detach
 quit
@@ -52,7 +53,6 @@ sep4="||||"
 # build up echo_clients attached to the given filters and record
 # their names and obj numbers for later use and teardown
 #
-last_filter="-1"
 [ -z "$FILTER_NAMES" ] && die "please specify filter names to run against"
 for fn in $FILTER_NAMES; do
        if not_a_filter $fn; then
@@ -63,7 +63,6 @@ lctl << EOF
        newdev
        attach echo_client $en ${en}_uuid
        setup $fn
-       probe
        quit
 EOF
        [ $? -eq 0 ] || die "error setting up echo_client (is obdecho loaded?)"
index 48ed0fd..1838cea 100755 (executable)
@@ -10,7 +10,7 @@ init_test_env $@
 
 . ${CONFIG:=$LUSTRE/tests/cfg/insanity-local.sh}
 
-ALWAYS_EXCEPT=""
+ALWAYS_EXCEPT="10"
 
 build_test_filter
 
@@ -57,11 +57,11 @@ reboot_node() {
 
 fail_clients() {
     num=$1
-    if [ -z "$num" -o $num -gt $((FAIL_NUM - DOWN_NUM)) ]; then
+    if [ -z "$num"  ] || [ "$num" -gt $((FAIL_NUM - DOWN_NUM)) ]; then
        num=$((FAIL_NUM - DOWN_NUM)) 
     fi
     
-    if [ -z "$num"  -o $num -le 0 ]; then
+    if [ -z "$num" ] || [ "$num" -le 0 ]; then
         return
     fi
 
@@ -111,7 +111,7 @@ setup() {
     [ "$DAEMONFILE" ] && $LCTL debug_daemon start $DAEMONFILE $DAEMONSIZE
     wait_for mds
     start mds $MDSLCONFARGS ${REFORMAT}
-    while ! $PDSH $HOST "$CHECKSTAT -t dir $LUSTRE"; do sleep 5; done
+    while ! do_node $HOST "$CHECKSTAT -t dir $LUSTRE"; do sleep 5; done
     do_node $CLIENTS lconf --node client_facet \
        --select mds_service=$ACTIVEMDS $XMLCONFIG
 }
@@ -140,7 +140,7 @@ client_mkdirs() {
 
 clients_recover_osts() {
     facet=$1
-    $PDSH $CLIENTS "$LCTL "'--device %OSC_`hostname`_OST_'"${facet}_svc_MNT_client recover"
+    $PDSH $CLIENTS "$LCTL "'--device %OSC_`hostname`_'"${facet}_svc_MNT_client_facet recover"
 }
 
 if [ "$ONLY" == "cleanup" ]; then
@@ -216,7 +216,7 @@ test_2() {
     wait $DFPID
     clients_recover_osts ost1
     echo "Verify reintegration"
-    client_df
+    client_df || return 1
 
 }
 run_test 2 "Second Failure Mode: MDS/OST `date`"
@@ -248,7 +248,7 @@ test_3() {
     echo "Reintegrating CLIENTS"
     reintegrate_clients
 
-    client_df
+    client_df || return 1
 }
 run_test 3  "Thirdb Failure Mode: MDS/CLIENT `date`"
 ###################################################
@@ -292,7 +292,7 @@ test_4() {
     wait $DFPID
     clients_recover_osts ost1
     echo "Test Lustre stability after MDS failover"
-    client_df
+    client_df || return 1
 }
 run_test 4 "Fourth Failure Mode: OST/MDS `date`"
 ###################################################
@@ -332,7 +332,8 @@ test_5() {
     
     clients_recover_osts ost1
     clients_recover_osts ost2
-    client_df
+    sleep 5
+    client_df || return 1
 }
 run_test 5 "Fifth Failure Mode: OST/OST `date`"
 ###################################################
@@ -343,8 +344,8 @@ test_6() {
 
     #Create files
     echo "Verify Lustre filesystem is up and running"
-    client_df
-    $PDSH $CLIENTS "/bin/touch $MOUNT/\`hostname\`_testfile"
+    client_df || return 1
+    $PDSH $CLIENTS "/bin/touch $MOUNT/\`hostname\`_testfile" || return 2
        
     #OST Portion
     echo "Failing OST"
@@ -368,9 +369,10 @@ test_6() {
     wait_for ost1
     start ost1
     reintegrate_clients
-    
+    sleep 5 
+
     echo "Verifying mount"
-    client_df
+    client_df || return 3
 }
 run_test 6 "Sixth Failure Mode: OST/CLIENT `date`"
 ###################################################
@@ -417,7 +419,7 @@ test_7() {
     #Reintegration
     echo "Reintegrating CLIENTs"
     reintegrate_clients
-    client_df
+    client_df || return 1
     
     #Sleep
     echo "wait 1 minutes"
@@ -470,8 +472,8 @@ test_8() {
     echo "Reintegrating CLIENTs/OST"
     reintegrate_clients
     start ost1
-    client_df
-    $PDSH $CLIENTS "/bin/touch $MOUNT/CLIENT_OST_2\`hostname\`_testfile"
+    client_df || return 1
+    $PDSH $CLIENTS "/bin/touch $MOUNT/CLIENT_OST_2\`hostname\`_testfile" || return 2
 
     #Sleep
     echo "Wait 1 minutes"
@@ -497,8 +499,8 @@ test_9() {
     #Check FS
     echo "Test Lustre stability after CLIENTs failure"
     client_df
-    $PDSH $LIVE_CLIENT "ls -l $MOUNT"
-    $PDSH $LIVE_CLIENT "rm -f $MOUNT/*_testfile"
+    $PDSH $LIVE_CLIENT "ls -l $MOUNT" || return 1
+    $PDSH $LIVE_CLIENT "rm -f $MOUNT/*_testfile" || return 2
 
     #Sleep
     echo "Wait 1 minutes"
@@ -506,8 +508,8 @@ test_9() {
 
     #Create files
     echo "Verify Lustre filesystem is up and running"
-    client_df
-    $PDSH $CLIENTS "/bin/touch $MOUNT/\`hostname\`_testfile"
+    client_df || return 3
+    $PDSH $CLIENTS "/bin/touch $MOUNT/\`hostname\`_testfile" || return 4
 
     #CLIENT Portion
     echo "Failing CLIENTs"
@@ -516,13 +518,13 @@ test_9() {
     #Check FS
     echo "Test Lustre stability after CLIENTs failure"
     client_df
-    $PDSH $LIVE_CLIENT "ls -l $MOUNT"
-    $PDSH $LIVE_CLIENT "rm -f $MOUNT/*_testfile"
+    $PDSH $LIVE_CLIENT "ls -l $MOUNT" || return 5
+    $PDSH $LIVE_CLIENT "rm -f $MOUNT/*_testfile" || return 6
 
     #Reintegration
     echo "Reintegrating  CLIENTs/CLIENTs"
     reintegrate_clients
-    client_df
+    client_df || return 7
     
     #Sleep
     echo "Wait 1 minutes"
index f403706..7125bdd 100644 (file)
@@ -43,6 +43,7 @@ extern int op_create_file(char *name, long stripe_size, int stripe_offset,
 extern int op_find(char *path, struct obd_uuid *obduuid, int recursive,
                 int verbose, int quiet);
 extern int op_check(int type_num, char **obd_type_p, char *dir);
+extern int op_catinfo(char *dir, char *keyword, char *node_name);
 
 /* all functions */
 static int lfs_setstripe(int argc, char **argv);
@@ -50,24 +51,32 @@ static int lfs_find(int argc, char **argv);
 static int lfs_getstripe(int argc, char **argv);
 static int lfs_osts(int argc, char **argv);
 static int lfs_check(int argc, char **argv);
+static int lfs_catinfo(int argc, char **argv);
 
 /* all avaialable commands */
 command_t cmdlist[] = {
         {"setstripe", lfs_setstripe, 0,
-         "blah...\n"
+         "To create a new file with a specific striping pattern.\n"
          "usage: setstripe <filename> <stripe size> <stripe start> <stripe count>\n"
          "\tstripe size:  Number of bytes in each stripe (0 default)\n"
          "\tstripe start: OST index of first stripe (-1 default)\n"
          "\tstripe count: Number of OSTs to stripe over (0 default)"},
         {"find", lfs_find, 0,
-         "blah...\n"
+         "To list the extended attributes for a given filename or files in a directory "
+         "or recursively for all files in a directory tree.\n"
          "usage: find [--obd <uuid>] [--quiet | --verbose] [--recursive] <dir|file> ..."},
         {"getstripe", lfs_getstripe, 0,
-         "blah...\n"
+         "To list the striping pattern for given filename.\n"
          "usage:getstripe <filename>"},
         {"check", lfs_check, 0, 
-         "blah...\n"
+         "Display the status of MDS or OSTs (as specified in the command) "
+         "or all the servers (MDS and OSTs).\n"
          "usage: check <osts|mds|servers>"},
+        {"catinfo", lfs_catinfo, 0,
+         "Show information of specified type logs.\n"
+         "usage: catinfo <keyword> [node name]"
+         "keywords are one of followings: config, deletions.\n"
+         "client node name must be provided when use keyword config."},
         {"osts", lfs_osts, 0, "osts"},
         {"help", Parser_help, 0, "help"},
         {"exit", Parser_quit, 0, "quit"},
@@ -284,6 +293,45 @@ static int lfs_check(int argc, char **argv)
 
 }
 
+static int lfs_catinfo(int argc, char **argv)
+{
+        FILE *fp;
+        struct mntent *mnt = NULL;
+        int rc;
+        
+        if (argc < 2 || (!strcmp(argv[1],"config") && argc < 3))
+                return CMD_HELP;
+
+        if (strcmp(argv[1], "config") && strcmp(argv[1], "deletions"))
+                return CMD_HELP;
+
+        fp = setmntent(MOUNTED, "r");
+        if (fp == NULL) {
+                 fprintf(stderr, "setmntent(%s): %s:", MOUNTED, 
+                         strerror(errno));
+        } else {
+                mnt = getmntent(fp);
+                while (feof(fp) == 0 && ferror(fp) == 0) {
+                        if (strcmp(mnt->mnt_type, "lustre_lite") == 0) 
+                                break;
+                        mnt = getmntent(fp);
+                }
+                endmntent(fp);
+        }
+
+        if (mnt) {
+                if (argc == 3)
+                        rc = op_catinfo(mnt->mnt_dir, argv[1], argv[2]);
+                else
+                        rc = op_catinfo(mnt->mnt_dir, argv[1], NULL);
+        } else {
+                fprintf(stderr, "no lustre_lite mounted.\n");
+                rc = -1;
+        }
+
+        return rc;
+}
+
 int main(int argc, char **argv)
 {
         int rc;
index 7ea801c..cb07fa4 100644 (file)
@@ -531,3 +531,44 @@ int op_check(int type_num, char **obd_type, char *dir)
 
 #undef MAX_STRING_SIZE
 
+int op_catinfo(char *dir, char *keyword, char *node_name)
+{
+        char raw[OBD_MAX_IOCTL_BUFFER];
+        char out[LLOG_CHUNK_SIZE];
+        char *buf = raw;
+        struct obd_ioctl_data data;
+        char key[30];
+        DIR *root;
+        int rc;
+        
+        sprintf(key, "%s", keyword);
+        memset(raw, 0, sizeof(buf));
+        memset(out, 0, sizeof(out));
+        data.ioc_inlbuf1 = key;
+        data.ioc_inllen1 = strlen(key) + 1;
+        if (node_name) {
+                data.ioc_inlbuf2 = node_name;
+                data.ioc_inllen2 = strlen(node_name) + 1;
+        }
+        data.ioc_pbuf1 = out;
+        data.ioc_plen1 = sizeof(out);
+        rc = obd_ioctl_pack(&data, &buf, sizeof(raw));
+        if (rc) 
+                return rc;
+        
+        root = opendir(dir);
+        if (root == NULL) {
+                err_msg("open %s failed", dir);
+                return errno;
+        }
+
+        rc = ioctl(dirfd(root), OBD_IOC_LLOG_CATINFO, buf); 
+        if (rc)
+                err_msg("ioctl OBD_IOC_CATINFO failed");
+        else
+                fprintf(stdout, "%s", data.ioc_pbuf1);
+                
+        closedir(root);
+        return rc;
+}
+