The following commit has been merged in the master branch:
commit 735a937500bbeccb6ca66341b71ff5875bacdc1c
Author: Patrick Winnertz <win...@debian.org>
Date:   Fri Jun 5 12:27:47 2009 +0200

    Fix some more compiling errors ...
    
    Signed-off-by: Patrick Winnertz <win...@debian.org>

diff --git a/debian/patches/bio_errors.dpatch b/debian/patches/bio_errors.dpatch
index 7bd0000..d6d8b91 100755
--- a/debian/patches/bio_errors.dpatch
+++ b/debian/patches/bio_errors.dpatch
@@ -6,8 +6,8 @@
 
 @DPATCH@
 diff -urNad lustre~/lustre/autoconf/lustre-core.m4 
lustre/lustre/autoconf/lustre-core.m4
---- lustre~/lustre/autoconf/lustre-core.m4     2009-06-05 10:57:07.000000000 
+0200
-+++ lustre/lustre/autoconf/lustre-core.m4      2009-06-05 10:57:07.000000000 
+0200
+--- lustre~/lustre/autoconf/lustre-core.m4     2009-06-05 12:14:33.000000000 
+0200
++++ lustre/lustre/autoconf/lustre-core.m4      2009-06-05 12:14:34.000000000 
+0200
 @@ -1390,6 +1390,41 @@
  ])
  ])
@@ -61,8 +61,8 @@ diff -urNad lustre~/lustre/autoconf/lustre-core.m4 
lustre/lustre/autoconf/lustre
  
  #
 diff -urNad lustre~/lustre/include/linux/lustre_compat25.h 
lustre/lustre/include/linux/lustre_compat25.h
---- lustre~/lustre/include/linux/lustre_compat25.h     2009-06-05 
10:57:07.000000000 +0200
-+++ lustre/lustre/include/linux/lustre_compat25.h      2009-06-05 
10:57:07.000000000 +0200
+--- lustre~/lustre/include/linux/lustre_compat25.h     2009-06-05 
12:14:33.000000000 +0200
++++ lustre/lustre/include/linux/lustre_compat25.h      2009-06-05 
12:14:34.000000000 +0200
 @@ -472,5 +472,13 @@
  #define       sysctl_vfs_cache_pressure       100
  #endif
@@ -78,8 +78,8 @@ diff -urNad lustre~/lustre/include/linux/lustre_compat25.h 
lustre/lustre/include
  #endif /* __KERNEL__ */
  #endif /* _COMPAT25_H */
 diff -urNad lustre~/lustre/llite/file.c lustre/lustre/llite/file.c
---- lustre~/lustre/llite/file.c        2009-06-05 10:57:07.000000000 +0200
-+++ lustre/lustre/llite/file.c 2009-06-05 10:57:07.000000000 +0200
+--- lustre~/lustre/llite/file.c        2009-06-05 12:14:33.000000000 +0200
++++ lustre/lustre/llite/file.c 2009-06-05 12:14:34.000000000 +0200
 @@ -1858,6 +1858,9 @@
  #endif
  }
@@ -130,22 +130,112 @@ diff -urNad lustre~/lustre/llite/file.c 
lustre/lustre/llite/file.c
          .flock          = ll_file_noflock,
 diff -urNad lustre~/lustre/llite/llite_nfs.c lustre/lustre/llite/llite_nfs.c
 --- lustre~/lustre/llite/llite_nfs.c   2009-06-02 11:38:20.000000000 +0200
-+++ lustre/lustre/llite/llite_nfs.c    2009-06-05 11:55:37.000000000 +0200
-@@ -146,57 +146,90 @@
++++ lustre/lustre/llite/llite_nfs.c    2009-06-05 12:26:41.000000000 +0200
+@@ -68,36 +68,30 @@
+ }
+ 
+ static struct inode * search_inode_for_lustre(struct super_block *sb,
+-                                              unsigned long ino,
+-                                              unsigned long generation,
+-                                              int mode)
++                                              struct ll_fid *iid)
+ {
+         struct ptlrpc_request *req = NULL;
+         struct ll_sb_info *sbi = ll_s2sbi(sb);
+-        struct ll_fid fid;
+         unsigned long valid = 0;
+         int eadatalen = 0, rc;
+         struct inode *inode = NULL;
+-        struct ll_fid iid = { .id = ino, .generation = generation };
+         ENTRY;
+ 
+-        inode = ILOOKUP(sb, ino, ll_nfs_test_inode, &iid);
++        inode = ILOOKUP(sb, iid->id, ll_nfs_test_inode, iid);
+ 
+         if (inode)
+                 RETURN(inode);
+-        if (S_ISREG(mode)) {
+-                rc = ll_get_max_mdsize(sbi, &eadatalen);
+-                if (rc) 
+-                        RETURN(ERR_PTR(rc));
+-                valid |= OBD_MD_FLEASIZE;
+-        }
+-        fid.id = (__u64)ino;
+-        fid.generation = generation;
+-        fid.f_type = mode;
+ 
+-        rc = mdc_getattr(sbi->ll_mdc_exp, &fid, valid, eadatalen, &req);
++        rc = ll_get_max_mdsize(sbi, &eadatalen);
++        if (rc)
++                RETURN(ERR_PTR(rc));
++
++        valid |= OBD_MD_FLEASIZE;
++
++        /* mds_fid2dentry is ignore f_type */
++        rc = mdc_getattr(sbi->ll_mdc_exp, iid, valid, eadatalen, &req);
+         if (rc) {
+-                CERROR("failure %d inode %lu\n", rc, ino);
++                CERROR("failure %d inode "LPU64"\n", rc, iid->id);
+                 RETURN(ERR_PTR(rc));
+         }
+ 
+@@ -111,27 +105,27 @@
+         RETURN(inode);
+ }
+ 
+-static struct dentry *ll_iget_for_nfs(struct super_block *sb, unsigned long 
ino,
+-                                      __u32 generation, umode_t mode)
++static struct dentry *ll_iget_for_nfs(struct super_block *sb,
++                                      struct ll_fid *iid)
+ {
+         struct inode *inode;
+         struct dentry *result;
+         ENTRY;
+ 
+-        if (ino == 0)
++        if (iid->id == 0)
+                 RETURN(ERR_PTR(-ESTALE));
+ 
+-        inode = search_inode_for_lustre(sb, ino, generation, mode);
+-        if (IS_ERR(inode)) {
++        inode = search_inode_for_lustre(sb, iid);
++        if (IS_ERR(inode))
+                 RETURN(ERR_PTR(PTR_ERR(inode)));
+-        }
++
+         if (is_bad_inode(inode) ||
+-            (generation && inode->i_generation != generation)){
++            (iid->generation && inode->i_generation != iid->generation)) {
+                 /* we didn't find the right inode.. */
+                 CERROR("Inode %lu, Bad count: %lu %d or version  %u %u\n",
+                        inode->i_ino, (unsigned long)inode->i_nlink,
+                        atomic_read(&inode->i_count), inode->i_generation,
+-                       generation);
++                       iid->generation);
+                 iput(inode);
+                 RETURN(ERR_PTR(-ESTALE));
+         }
+@@ -146,57 +140,102 @@
          RETURN(result);
  }
  
 -struct dentry *ll_fh_to_dentry(struct super_block *sb, __u32 *data, int len,
 -                               int fhtype, int parent)
-+#define LUSTRE_NFS_FID 0x94
++#define LUSTRE_NFS_FID                0x94
 +
 +struct lustre_nfs_fid {
-+      struct ll_fid child;
-+      struct ll_fid parent;
-+      umode_t       mode;
++        struct ll_fid   child;
++        struct ll_fid   parent;
++        umode_t         mode;
 +};
 +
-+static int ll_encode_fh(struct dentry *de, __u32 *fh, int *plen, int 
connectable)
++/* The return value is file handle type:
++ * 1 -- contains child file handle;
++ * 2 -- contains child file handle and parent file handle;
++ * 255 -- error.
++ */
++static int ll_encode_fh(struct dentry *de, __u32 *fh, int *plen,
++                        int connectable)
  {
 -        switch (fhtype) {
 -                case 2:
@@ -162,38 +252,39 @@ diff -urNad lustre~/lustre/llite/llite_nfs.c 
lustre/lustre/llite/llite_nfs.c
 -                default: break;
 -        }
 -        return ERR_PTR(-EINVAL);
-+      struct inode *inode = de->d_inode;
-+      struct inode *parent = de->d_parent->d_inode;
-+      struct lustre_nfs_fid *nfs_fid = (void *)fh;
-+      ENTRY;
++        struct inode *inode = de->d_inode;
++        struct inode *parent = de->d_parent->d_inode;
++        struct lustre_nfs_fid *nfs_fid = (void *)fh;
++        ENTRY;
 +
-+      CDEBUG(D_INFO, "encoding for (%lu) maxlen=%d minlen=%u\n",
-+                      inode->i_ino, *plen, (int)sizeof(struct 
lustre_nfs_fid));
++        CDEBUG(D_INFO, "encoding for (%lu) maxlen=%d minlen=%u\n",
++              inode->i_ino, *plen,
++              (int)sizeof(struct lustre_nfs_fid));
 +
-+      if (*plen < sizeof(struct lustre_nfs_fid))
-+              RETURN(255);
++        if (*plen < sizeof(struct lustre_nfs_fid))
++                RETURN(255);
 +
-+      ll_inode2fid(&nfs_fid->child, inode);
-+      ll_inode2fid(&nfs_fild->parent, inode);
++        ll_inode2fid(&nfs_fid->child, inode);
++        ll_inode2fid(&nfs_fid->parent, parent);
 +
-+      nfs_fid->mode = (S_IFMT  & inode->i_mode);
-+      *plen = sizeof(struct lustre_nfs_fid);
++        nfs_fid->mode = (S_IFMT & inode->i_mode);
++        *plen = sizeof(struct lustre_nfs_fid);
 +
-+      RETURN(LUSTRE_NFS_FID);
++        RETURN(LUSTRE_NFS_FID);
  }
  
 -int ll_dentry_to_fh(struct dentry *dentry, __u32 *datap, int *lenp,
 -                    int need_parent)
 +#ifdef HAVE_FH_TO_DENTRY
-+struct dentry *ll_fh_to_dentry(struct super_block *sb, struct fid *fid,
-+                               int fh_len int fh_type)
++static struct dentry *ll_fh_to_dentry(struct super_block *sb, struct fid *fid,
++                                      int fh_len, int fh_type)
  {
 -        if (*lenp < 3)
 -                return 255;
 -        *datap++ = dentry->d_inode->i_ino;
 -        *datap++ = dentry->d_inode->i_generation;
 -        *datap++ = (__u32)(S_IFMT & dentry->d_inode->i_mode);
-+      struct lustre_nfs_fid *nfs_fid = (struct lustre_nfs_fid*)fid;
++        struct lustre_nfs_fid *nfs_fid = (struct lustre_nfs_fid *)fid;
  
 -        if (*lenp == 3 || S_ISDIR(dentry->d_inode->i_mode)) {
 -                *lenp = 3;
@@ -202,16 +293,318 @@ diff -urNad lustre~/lustre/llite/llite_nfs.c 
lustre/lustre/llite/llite_nfs.c
 -        if (dentry->d_parent) {
 -                *datap++ = dentry->d_parent->d_inode->i_ino;
 -                *datap++ = (__u32)(S_IFMT & 
dentry->d_parent->d_inode->i_mode);
-+      if (fh_type != LUSTRE_NFS_FID)
-+              RETURN(ERR_PTR(-EINVAL));
-+      RETURN(ll_iget_for_nfs(sb, &nfs_fid->child));
-+}
++        if (fh_type != LUSTRE_NFS_FID)
++                RETURN(ERR_PTR(-EINVAL));
  
 -                *lenp = 5;
 -                return 2;
 -        }
 -        *lenp = 3;
 -        return 1;
++        RETURN(ll_iget_for_nfs(sb, &nfs_fid->child));
++}
++static struct dentry *ll_fh_to_parent(struct super_block *sb, struct fid *fid,
++                                      int fh_len, int fh_type)
++{
++        struct lustre_nfs_fid *nfs_fid = (struct lustre_nfs_fid *)fid;
++
++        if (fh_type != LUSTRE_NFS_FID)
++                RETURN(ERR_PTR(-EINVAL));
++        RETURN(ll_iget_for_nfs(sb, &nfs_fid->parent));
+ }
+ 
+-#if THREAD_SIZE >= 8192
++#else
++/*
++ * This length is counted as amount of __u32,
++ *  It is composed of a fid and a mode
++ */
++static struct dentry *ll_decode_fh(struct super_block *sb, __u32 *fh, int 
fh_len,
++                                     int fh_type,
++                                     int (*acceptable)(void *, struct dentry 
*),
++                                     void *context)
++{
++        struct lustre_nfs_fid *nfs_fid = (void *)fh;
++        struct dentry *entry;
++        ENTRY;
++
++        CDEBUG(D_INFO, "decoding for "LPU64" fh_len=%d fh_type=%x\n",
++                nfs_fid->child.id, fh_len, fh_type);
++
++        if (fh_type != LUSTRE_NFS_FID)
++                  RETURN(ERR_PTR(-ESTALE));
++
++        entry = sb->s_export_op->find_exported_dentry(sb, &nfs_fid->child,
++                                                      &nfs_fid->parent,
++                                                      acceptable, context);
++        RETURN(entry);
++}
++
++
+ struct dentry *ll_get_dentry(struct super_block *sb, void *data)
+ {
+-        __u32 *inump = (__u32*)data;
+-        return ll_iget_for_nfs(sb, inump[0], inump[1], S_IFREG);
++        struct lustre_nfs_fid *fid = data;
++        ENTRY;
++
++        RETURN(ll_iget_for_nfs(sb, &fid->child));
++
+ }
+ 
++#endif
++
+ struct dentry *ll_get_parent(struct dentry *dchild)
+ {
+         struct ptlrpc_request *req = NULL;
+@@ -208,11 +247,11 @@
+         char dotdot[] = "..";
+         int  rc = 0;
+         ENTRY;
+-        
++
+         LASSERT(dir && S_ISDIR(dir->i_mode));
+-        
+-        sbi = ll_s2sbi(dir->i_sb);       
+- 
++
++        sbi = ll_s2sbi(dir->i_sb);
++
+         fid.id = (__u64)dir->i_ino;
+         fid.generation = dir->i_generation;
+         fid.f_type = S_IFDIR;
+@@ -223,11 +262,12 @@
+                 CERROR("failure %d inode %lu get parent\n", rc, dir->i_ino);
+                 return ERR_PTR(rc);
+         }
+-        body = lustre_msg_buf(req->rq_repmsg, REPLY_REC_OFF, sizeof (*body)); 
+-       
++        body = lustre_msg_buf(req->rq_repmsg, REPLY_REC_OFF, sizeof (*body));
++
+         LASSERT((body->valid & OBD_MD_FLGENER) && (body->valid & 
OBD_MD_FLID));
+-        
+-        result = ll_iget_for_nfs(dir->i_sb, body->ino, body->generation, 
S_IFDIR);
++        fid.id = body->ino;
++        fid.generation = body->generation;
++        result = ll_iget_for_nfs(dir->i_sb, &fid);
+ 
+         if (IS_ERR(result))
+                 rc = PTR_ERR(result);
+@@ -236,10 +276,18 @@
+         if (rc)
+                 return ERR_PTR(rc);
+         RETURN(result);
+-} 
++}
+ 
++
++#if THREAD_SIZE >= 8192
+ struct export_operations lustre_export_operations = {
+-       .get_parent = ll_get_parent,
+-       .get_dentry = ll_get_dentry, 
++        .encode_fh  = ll_encode_fh,
++#ifdef HAVE_FH_TO_DENTRY
++        .fh_to_dentry = ll_fh_to_dentry,
++        .fh_to_parent = ll_fh_to_parent,
++#else
++        .get_dentry = ll_get_dentry,
++        .decode_fh  = ll_decode_fh,
++#endif
+ };
+ #endif
+diff -urNad lustre~/lustre/llite/llite_nfs.c.orig 
lustre/lustre/llite/llite_nfs.c.orig
+--- lustre~/lustre/llite/llite_nfs.c.orig      1970-01-01 01:00:00.000000000 
+0100
++++ lustre/lustre/llite/llite_nfs.c.orig       2009-06-05 12:26:34.000000000 
+0200
+@@ -0,0 +1,286 @@
++/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
++ * vim:expandtab:shiftwidth=8:tabstop=8:
++ *
++ * GPL HEADER START
++ *
++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License version 2 only,
++ * as published by the Free Software Foundation.
++ *
++ * This program 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 version 2 for more details (a copy is included
++ * in the LICENSE file that accompanied this code).
++ *
++ * You should have received a copy of the GNU General Public License
++ * version 2 along with this program; If not, see
++ * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
++ *
++ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
++ * CA 95054 USA or visit www.sun.com if you need additional information or
++ * have any questions.
++ *
++ * GPL HEADER END
++ */
++/*
++ * Copyright  2008 Sun Microsystems, Inc. All rights reserved
++ * Use is subject to license terms.
++ */
++/*
++ * This file is part of Lustre, http://www.lustre.org/
++ * Lustre is a trademark of Sun Microsystems, Inc.
++ *
++ * lustre/llite/llite_nfs.c
++ *
++ * NFS export of Lustre Light File System
++ */
++
++#define DEBUG_SUBSYSTEM S_LLITE
++#include <lustre_lite.h>
++#include "llite_internal.h"
++#ifdef HAVE_LINUX_EXPORTFS_H
++#include <linux/exportfs.h>
++#endif
++
++__u32 get_uuid2int(const char *name, int len)
++{
++        __u32 key0 = 0x12a3fe2d, key1 = 0x37abe8f9;
++        while (len--) {
++                __u32 key = key1 + (key0 ^ (*name++ * 7152373));
++                if (key & 0x80000000) key -= 0x7fffffff;
++                key1 = key0;
++                key0 = key;
++        }
++        return (key0 << 1);
++}
++
++static int ll_nfs_test_inode(struct inode *inode, void *opaque)
++{
++        struct ll_fid *iid = opaque;
++
++        if (inode->i_ino == iid->id && inode->i_generation == iid->generation)
++                return 1;
++
++        return 0;
++}
++
++static struct inode * search_inode_for_lustre(struct super_block *sb,
++                                              unsigned long ino,
++                                              unsigned long generation,
++                                              int mode)
++{
++        struct ptlrpc_request *req = NULL;
++        struct ll_sb_info *sbi = ll_s2sbi(sb);
++        struct ll_fid fid;
++        unsigned long valid = 0;
++        int eadatalen = 0, rc;
++        struct inode *inode = NULL;
++        struct ll_fid iid = { .id = ino, .generation = generation };
++        ENTRY;
++
++        inode = ILOOKUP(sb, ino, ll_nfs_test_inode, &iid);
++
++        if (inode)
++                RETURN(inode);
++        if (S_ISREG(mode)) {
++                rc = ll_get_max_mdsize(sbi, &eadatalen);
++                if (rc) 
++                        RETURN(ERR_PTR(rc));
++                valid |= OBD_MD_FLEASIZE;
++        }
++        fid.id = (__u64)ino;
++        fid.generation = generation;
++        fid.f_type = mode;
++
++        rc = mdc_getattr(sbi->ll_mdc_exp, &fid, valid, eadatalen, &req);
++        if (rc) {
++                CERROR("failure %d inode %lu\n", rc, ino);
++                RETURN(ERR_PTR(rc));
++        }
++
++        rc = ll_prep_inode(sbi->ll_osc_exp, &inode, req, REPLY_REC_OFF, sb);
++        if (rc) {
++                ptlrpc_req_finished(req);
++                RETURN(ERR_PTR(rc));
++        }
++        ptlrpc_req_finished(req);
++
++        RETURN(inode);
++}
++
++static struct dentry *ll_iget_for_nfs(struct super_block *sb, unsigned long 
ino,
++                                      __u32 generation, umode_t mode)
++{
++        struct inode *inode;
++        struct dentry *result;
++        ENTRY;
++
++        if (ino == 0)
++                RETURN(ERR_PTR(-ESTALE));
++
++        inode = search_inode_for_lustre(sb, ino, generation, mode);
++        if (IS_ERR(inode)) {
++                RETURN(ERR_PTR(PTR_ERR(inode)));
++        }
++        if (is_bad_inode(inode) ||
++            (generation && inode->i_generation != generation)){
++                /* we didn't find the right inode.. */
++                CERROR("Inode %lu, Bad count: %lu %d or version  %u %u\n",
++                       inode->i_ino, (unsigned long)inode->i_nlink,
++                       atomic_read(&inode->i_count), inode->i_generation,
++                       generation);
++                iput(inode);
++                RETURN(ERR_PTR(-ESTALE));
++        }
++
++        result = d_alloc_anon(inode);
++        if (!result) {
++                iput(inode);
++                RETURN(ERR_PTR(-ENOMEM));
++        }
++        ll_dops_init(result, 1);
++
++        RETURN(result);
++}
++
++#define LUSTRE_NFS_FID 0x94
++
++struct lustre_nfs_fid {
++      struct ll_fid child;
++      struct ll_fid parent;
++      umode_t       mode;
++};
++
++static int ll_encode_fh(struct dentry *de, __u32 *fh, int *plen, int 
connectable)
++{
++      struct inode *inode = de->d_inode;
++      struct inode *parent = de->d_parent->d_inode;
++      struct lustre_nfs_fid *nfs_fid = (void *)fh;
++      ENTRY;
++
++      CDEBUG(D_INFO, "encoding for (%lu) maxlen=%d minlen=%u\n",
++                      inode->i_ino, *plen, (int)sizeof(struct 
lustre_nfs_fid));
++
++      if (*plen < sizeof(struct lustre_nfs_fid))
++              RETURN(255);
++
++      ll_inode2fid(&nfs_fid->child, inode);
++      ll_inode2fid(&nfs_fid->parent, inode);
++
++      nfs_fid->mode = (S_IFMT  & inode->i_mode);
++      *plen = sizeof(struct lustre_nfs_fid);
++
++      RETURN(LUSTRE_NFS_FID);
++}
++
++#ifdef HAVE_FH_TO_DENTRY
++struct dentry *ll_fh_to_dentry(struct super_block *sb, struct fid *fid,
++                               int fh_len int fh_type)
++{
++      struct lustre_nfs_fid *nfs_fid = (struct lustre_nfs_fid*)fid;
++
++      if (fh_type != LUSTRE_NFS_FID)
++              RETURN(ERR_PTR(-EINVAL));
++      RETURN(ll_iget_for_nfs(sb, &nfs_fid->child));
++}
++
 +static struct dentry *ll_fh_to_parent(struct super_block *sb, struct fid *fid,
 +                                      int fh_len, int fh_type)
 +{
@@ -243,47 +636,62 @@ diff -urNad lustre~/lustre/llite/llite_nfs.c 
lustre/lustre/llite/llite_nfs.c
 +                                                      &nfs_fid->parent,
 +                                                      acceptable, context);
 +      RETURN(entry);
- }
- 
--#if THREAD_SIZE >= 8192
- struct dentry *ll_get_dentry(struct super_block *sb, void *data)
- {
--        __u32 *inump = (__u32*)data;
--        return ll_iget_for_nfs(sb, inump[0], inump[1], S_IFREG);
++}
++
++struct dentry *ll_get_dentry(struct super_block *sb, void *data)
++{
 +      struct lustre_nfs_fid *fid = data;
 +      ENTRY;
 +      
 +      RETURN(ll_iget_for_nfs(sb, &fid->child));
- }
- 
++}
++
 +#endif
 +
- struct dentry *ll_get_parent(struct dentry *dchild)
- {
-         struct ptlrpc_request *req = NULL;
-@@ -224,10 +257,11 @@
-                 return ERR_PTR(rc);
-         }
-         body = lustre_msg_buf(req->rq_repmsg, REPLY_REC_OFF, sizeof (*body)); 
--       
++struct dentry *ll_get_parent(struct dentry *dchild)
++{
++        struct ptlrpc_request *req = NULL;
++        struct inode *dir = dchild->d_inode;
++        struct ll_sb_info *sbi;
++        struct dentry *result = NULL;
++        struct ll_fid fid;
++        struct mds_body *body;
++        char dotdot[] = "..";
++        int  rc = 0;
++        ENTRY;
++        
++        LASSERT(dir && S_ISDIR(dir->i_mode));
++        
++        sbi = ll_s2sbi(dir->i_sb);       
++ 
++        fid.id = (__u64)dir->i_ino;
++        fid.generation = dir->i_generation;
++        fid.f_type = S_IFDIR;
 +
-         LASSERT((body->valid & OBD_MD_FLGENER) && (body->valid & 
OBD_MD_FLID));
--        
--        result = ll_iget_for_nfs(dir->i_sb, body->ino, body->generation, 
S_IFDIR);
++        rc = mdc_getattr_name(sbi->ll_mdc_exp, &fid, dotdot, strlen(dotdot) + 
1,
++                              0, 0, &req);
++        if (rc) {
++                CERROR("failure %d inode %lu get parent\n", rc, dir->i_ino);
++                return ERR_PTR(rc);
++        }
++        body = lustre_msg_buf(req->rq_repmsg, REPLY_REC_OFF, sizeof (*body)); 
++
++        LASSERT((body->valid & OBD_MD_FLGENER) && (body->valid & 
OBD_MD_FLID));
 +      fid.id = body->ino;
 +      fid.generation = body->generation;
 +      result = ll_iget_for_nfs(dir->i_sb, &fid);
- 
-         if (IS_ERR(result))
-                 rc = PTR_ERR(result);
-@@ -238,8 +272,15 @@
-         RETURN(result);
- } 
- 
++
++        if (IS_ERR(result))
++                rc = PTR_ERR(result);
++
++        ptlrpc_req_finished(req);
++        if (rc)
++                return ERR_PTR(rc);
++        RETURN(result);
++} 
++
 +#if THREAD_SIZE >= 8192
- struct export_operations lustre_export_operations = {
--       .get_parent = ll_get_parent,
--       .get_dentry = ll_get_dentry, 
++struct export_operations lustre_export_operations = {
 +      .encode_fh = ll_encode_fh,
 +#ifdef HAVE_FH_TO_DENTRY
 +       .fh_to_dentry = ll_fh_to_dentry,
@@ -292,12 +700,12 @@ diff -urNad lustre~/lustre/llite/llite_nfs.c 
lustre/lustre/llite/llite_nfs.c
 +      .decode_fh  = ll_decode_fh,
 +      .get_dentry = ll_get_dentry,
 +#endif
- };
- #endif
++};
++#endif
 diff -urNad lustre~/lustre/llite/llite_nfs.c~ lustre/lustre/llite/llite_nfs.c~
 --- lustre~/lustre/llite/llite_nfs.c~  1970-01-01 01:00:00.000000000 +0100
-+++ lustre/lustre/llite/llite_nfs.c~   2009-06-02 11:38:20.000000000 +0200
-@@ -0,0 +1,245 @@
++++ lustre/lustre/llite/llite_nfs.c~   2009-06-05 12:14:34.000000000 +0200
+@@ -0,0 +1,286 @@
 +/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
 + * vim:expandtab:shiftwidth=8:tabstop=8:
 + *
@@ -446,57 +854,90 @@ diff -urNad lustre~/lustre/llite/llite_nfs.c~ 
lustre/lustre/llite/llite_nfs.c~
 +        RETURN(result);
 +}
 +
-+struct dentry *ll_fh_to_dentry(struct super_block *sb, __u32 *data, int len,
-+                               int fhtype, int parent)
++#define LUSTRE_NFS_FID 0x94
++
++struct lustre_nfs_fid {
++      struct ll_fid child;
++      struct ll_fid parent;
++      umode_t       mode;
++};
++
++static int ll_encode_fh(struct dentry *de, __u32 *fh, int *plen, int 
connectable)
 +{
-+        switch (fhtype) {
-+                case 2:
-+                        if (len < 5)
-+                                break;
-+                        if (parent)
-+                                return ll_iget_for_nfs(sb, data[3], 0, 
data[4]);
-+                case 1:
-+                        if (len < 3)
-+                                break;
-+                        if (parent)
-+                                break;
-+                        return ll_iget_for_nfs(sb, data[0], data[1], data[2]);
-+                default: break;
-+        }
-+        return ERR_PTR(-EINVAL);
++      struct inode *inode = de->d_inode;
++      struct inode *parent = de->d_parent->d_inode;
++      struct lustre_nfs_fid *nfs_fid = (void *)fh;
++      ENTRY;
++
++      CDEBUG(D_INFO, "encoding for (%lu) maxlen=%d minlen=%u\n",
++                      inode->i_ino, *plen, (int)sizeof(struct 
lustre_nfs_fid));
++
++      if (*plen < sizeof(struct lustre_nfs_fid))
++              RETURN(255);
++
++      ll_inode2fid(&nfs_fid->child, inode);
++      ll_inode2fid(&nfs_fild->parent, inode);
++
++      nfs_fid->mode = (S_IFMT  & inode->i_mode);
++      *plen = sizeof(struct lustre_nfs_fid);
++
++      RETURN(LUSTRE_NFS_FID);
 +}
 +
-+int ll_dentry_to_fh(struct dentry *dentry, __u32 *datap, int *lenp,
-+                    int need_parent)
++#ifdef HAVE_FH_TO_DENTRY
++struct dentry *ll_fh_to_dentry(struct super_block *sb, struct fid *fid,
++                               int fh_len int fh_type)
 +{
-+        if (*lenp < 3)
-+                return 255;
-+        *datap++ = dentry->d_inode->i_ino;
-+        *datap++ = dentry->d_inode->i_generation;
-+        *datap++ = (__u32)(S_IFMT & dentry->d_inode->i_mode);
-+
-+        if (*lenp == 3 || S_ISDIR(dentry->d_inode->i_mode)) {
-+                *lenp = 3;
-+                return 1;
-+        }
-+        if (dentry->d_parent) {
-+                *datap++ = dentry->d_parent->d_inode->i_ino;
-+                *datap++ = (__u32)(S_IFMT & 
dentry->d_parent->d_inode->i_mode);
++      struct lustre_nfs_fid *nfs_fid = (struct lustre_nfs_fid*)fid;
 +
-+                *lenp = 5;
-+                return 2;
-+        }
-+        *lenp = 3;
-+        return 1;
++      if (fh_type != LUSTRE_NFS_FID)
++              RETURN(ERR_PTR(-EINVAL));
++      RETURN(ll_iget_for_nfs(sb, &nfs_fid->child));
++}
++
++static struct dentry *ll_fh_to_parent(struct super_block *sb, struct fid *fid,
++                                      int fh_len, int fh_type)
++{
++      struct lustre_nfs_fid *nfs_fid = (struct lustre_nfs_fid*)fid;
++
++      if (fh_type != LUSTRE_NFS_FID)
++              RETURN(ERR_PTR(-EINVAL));
++      RETURN(ll_iget_for_nfs(sb, &nfs_fid->parent));
++}
++
++#else
++
++static struct dentry *ll_decode_fh(struct super_block *sb, __u32 *fh, int 
fh_len,
++                                      int fh_type,
++                                      int (*acceptable)(void *, struct dentry 
*),
++                                      void *context)
++{
++      struct lustre_nfs_fid *nfs_fid = (void *)fh;
++      struct dentry *entry;
++      ENTRY;
++
++      CDEBUG(D_INFO, "decoding for "LPU64" fh_len=%d fh_type=%x\n",
++              nfs_fid->child.id,fh_len,fh_type);
++
++      if (fh_type != LUSTRE_NFS_FID)
++              RETURN(ERR_PTR(-ESTALE));
++
++      entry = sb->s_export_op->find_exported_dentry(sb, &nfs_fid->child,
++                                                      &nfs_fid->parent,
++                                                      acceptable, context);
++      RETURN(entry);
 +}
 +
-+#if THREAD_SIZE >= 8192
 +struct dentry *ll_get_dentry(struct super_block *sb, void *data)
 +{
-+        __u32 *inump = (__u32*)data;
-+        return ll_iget_for_nfs(sb, inump[0], inump[1], S_IFREG);
++      struct lustre_nfs_fid *fid = data;
++      ENTRY;
++      
++      RETURN(ll_iget_for_nfs(sb, &fid->child));
 +}
 +
++#endif
++
 +struct dentry *ll_get_parent(struct dentry *dchild)
 +{
 +        struct ptlrpc_request *req = NULL;
@@ -524,10 +965,11 @@ diff -urNad lustre~/lustre/llite/llite_nfs.c~ 
lustre/lustre/llite/llite_nfs.c~
 +                return ERR_PTR(rc);
 +        }
 +        body = lustre_msg_buf(req->rq_repmsg, REPLY_REC_OFF, sizeof (*body)); 
-+       
++
 +        LASSERT((body->valid & OBD_MD_FLGENER) && (body->valid & 
OBD_MD_FLID));
-+        
-+        result = ll_iget_for_nfs(dir->i_sb, body->ino, body->generation, 
S_IFDIR);
++      fid.id = body->ino;
++      fid.generation = body->generation;
++      result = ll_iget_for_nfs(dir->i_sb, &fid);
 +
 +        if (IS_ERR(result))
 +                rc = PTR_ERR(result);
@@ -538,14 +980,21 @@ diff -urNad lustre~/lustre/llite/llite_nfs.c~ 
lustre/lustre/llite/llite_nfs.c~
 +        RETURN(result);
 +} 
 +
++#if THREAD_SIZE >= 8192
 +struct export_operations lustre_export_operations = {
-+       .get_parent = ll_get_parent,
-+       .get_dentry = ll_get_dentry, 
++      .encode_fh = ll_encode_fh,
++#ifdef HAVE_FH_TO_DENTRY
++       .fh_to_dentry = ll_fh_to_dentry,
++       .fh_to_parent = ll_fh_to_parent,
++#else
++      .decode_fh  = ll_decode_fh,
++      .get_dentry = ll_get_dentry,
++#endif
 +};
 +#endif
 diff -urNad lustre~/lustre/llite/lloop.c lustre/lustre/llite/lloop.c
 --- lustre~/lustre/llite/lloop.c       2009-06-02 11:38:20.000000000 +0200
-+++ lustre/lustre/llite/lloop.c        2009-06-05 10:57:07.000000000 +0200
++++ lustre/lustre/llite/lloop.c        2009-06-05 12:14:34.000000000 +0200
 @@ -347,7 +347,7 @@
          loop_add_bio(lo, old_bio);
          return 0;

-- 
Lustre Debian Packaging 

_______________________________________________
Pkg-lustre-svn-commit mailing list
Pkg-lustre-svn-commit@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/pkg-lustre-svn-commit

Reply via email to