Whamcloud - gitweb
LU-3105 mdc: remove capa support 69/6069/8
authorAlex Zhuravlev <alexey.zhuravlev@intel.com>
Wed, 29 Apr 2015 16:15:47 +0000 (11:15 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 16 Jun 2015 08:47:02 +0000 (08:47 +0000)
Remove capa support from the MDC, LMV, and llite layers. Remove the
then unused capa code in lustre/obdclass/ and lustre_capa.h.

Signed-off-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: Id2c260cd11fe4cb753b77af8a42932cde650274b
Reviewed-on: http://review.whamcloud.com/6069
Tested-by: Jenkins
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
28 files changed:
lustre/autoconf/lustre-core.m4
lustre/fid/fid_store.c
lustre/include/Makefile.am
lustre/include/lustre/lustre_idl.h
lustre/include/lustre_capa.h [deleted file]
lustre/include/obd.h
lustre/include/obd_class.h
lustre/llite/Makefile.in
lustre/llite/file.c
lustre/llite/llite_capa.c [deleted file]
lustre/llite/llite_internal.h
lustre/llite/llite_lib.c
lustre/llite/remote_perm.c
lustre/llite/statahead.c
lustre/llite/super25.c
lustre/llite/vvp_internal.h
lustre/llite/xattr.c
lustre/lmv/lmv_obd.c
lustre/mdc/mdc_internal.h
lustre/mdc/mdc_lib.c
lustre/mdc/mdc_locks.c
lustre/mdc/mdc_reint.c
lustre/mdc/mdc_request.c
lustre/obdclass/Makefile.in
lustre/obdclass/capa.c [deleted file]
lustre/obdclass/class_obd.c
lustre/obdclass/genops.c
lustre/obdclass/lprocfs_status.c

index daa9119..1b425c0 100644 (file)
@@ -215,18 +215,6 @@ LB_CHECK_EXPORT([delete_from_page_cache], [mm/filemap.c],
 ]) # LC_EXPORT_TRUNCATE_COMPLETE_PAGE
 
 #
 ]) # LC_EXPORT_TRUNCATE_COMPLETE_PAGE
 
 #
-# LC_CAPA_CRYPTO
-#
-AC_DEFUN([LC_CAPA_CRYPTO], [
-LB_CHECK_CONFIG_IM([CRYPTO], [],
-       [AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO is enabled in your kernel.])])
-LB_CHECK_CONFIG_IM([CRYPTO_HMAC], [],
-       [AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_HMAC is enabled in your kernel.])])
-LB_CHECK_CONFIG_IM([CRYPTO_SHA1], [],
-       [AC_MSG_ERROR([Lustre capability require that CONFIG_CRYPTO_SHA1 is enabled in your kernel.])])
-]) # LC_CAPA_CRYPTO
-
-#
 # LC_CONFIG_RMTCLIENT
 #
 dnl FIXME
 # LC_CONFIG_RMTCLIENT
 #
 dnl FIXME
@@ -1693,7 +1681,6 @@ AC_DEFUN([LC_PROG_LINUX], [
        LC_LLITE_LLOOP_MODULE
 
        LC_GLIBC_SUPPORT_FHANDLES
        LC_LLITE_LLOOP_MODULE
 
        LC_GLIBC_SUPPORT_FHANDLES
-       LC_CAPA_CRYPTO
        LC_CONFIG_RMTCLIENT
        LC_CONFIG_GSS
 
        LC_CONFIG_RMTCLIENT
        LC_CONFIG_GSS
 
index 184dd37..9edd13c 100644 (file)
@@ -45,7 +45,6 @@
 #include <libcfs/libcfs.h>
 #include <dt_object.h>
 #include <obd_support.h>
 #include <libcfs/libcfs.h>
 #include <dt_object.h>
 #include <obd_support.h>
-#include <lustre_capa.h>
 #include <lustre_fid.h>
 #include <lustre_fld.h>
 #include "fid_internal.h"
 #include <lustre_fid.h>
 #include <lustre_fld.h>
 #include "fid_internal.h"
index 435f104..ed4e963 100644 (file)
@@ -48,7 +48,6 @@ EXTRA_DIST = \
        lu_object.h \
        lu_ref.h \
        lustre_acl.h \
        lu_object.h \
        lu_ref.h \
        lustre_acl.h \
-       lustre_capa.h \
        lustre_cfg.h \
        lustre_compat.h \
        lustre_debug.h \
        lustre_cfg.h \
        lustre_compat.h \
        lustre_debug.h \
index 538fb22..e035668 100644 (file)
@@ -3847,21 +3847,6 @@ enum {
 #define CAPA_OPC_MDS_DEFAULT ~CAPA_OPC_OSS_ONLY
 #define CAPA_OPC_OSS_DEFAULT ~(CAPA_OPC_MDS_ONLY | CAPA_OPC_OSS_ONLY)
 
 #define CAPA_OPC_MDS_DEFAULT ~CAPA_OPC_OSS_ONLY
 #define CAPA_OPC_OSS_DEFAULT ~(CAPA_OPC_MDS_ONLY | CAPA_OPC_OSS_ONLY)
 
-/* MDS capability covers object capability for operations of body r/w
- * (dir readpage/sendpage), index lookup/insert/delete and meta data r/w,
- * while OSS capability only covers object capability for operations of
- * oss data(file content) r/w/truncate.
- */
-static inline int capa_for_mds(struct lustre_capa *c)
-{
-        return (c->lc_opc & CAPA_OPC_INDEX_LOOKUP) != 0;
-}
-
-static inline int capa_for_oss(struct lustre_capa *c)
-{
-        return (c->lc_opc & CAPA_OPC_INDEX_LOOKUP) == 0;
-}
-
 static inline bool lovea_slot_is_dummy(const struct lov_ost_data_v1 *obj)
 {
        /* zero area does not care about the bytes-order. */
 static inline bool lovea_slot_is_dummy(const struct lov_ost_data_v1 *obj)
 {
        /* zero area does not care about the bytes-order. */
diff --git a/lustre/include/lustre_capa.h b/lustre/include/lustre_capa.h
deleted file mode 100644 (file)
index 5a950db..0000000
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
- * 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 (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
- * Use is subject to license terms.
- *
- * Copyright (c) 2012, 2013, Intel Corporation.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
- *
- * lustre/include/lustre_capa.h
- *
- * Author: Lai Siyao <lsy@clusterfs.com>
- */
-
-#ifndef __LINUX_CAPA_H_
-#define __LINUX_CAPA_H_
-
-/** \defgroup capa capa
- *
- * @{
- */
-
-/*
- * capability
- */
-#include <linux/crypto.h>
-#include <lustre/lustre_idl.h>
-
-#define CAPA_TIMEOUT 1800                /* sec, == 30 min */
-#define CAPA_KEY_TIMEOUT (24 * 60 * 60)  /* sec, == 1 days */
-
-struct capa_hmac_alg {
-        const char     *ha_name;
-        int             ha_len;
-        int             ha_keylen;
-};
-
-#define DEF_CAPA_HMAC_ALG(name, type, len, keylen)      \
-[CAPA_HMAC_ALG_ ## type] = {                            \
-        .ha_name         = name,                        \
-        .ha_len          = len,                         \
-        .ha_keylen       = keylen,                      \
-}
-
-struct client_capa {
-       struct inode            *inode;
-       struct list_head        lli_list;       /* link to lli_oss_capas */
-};
-
-struct target_capa {
-       struct hlist_node       c_hash;         /* link to capa hash */
-};
-
-struct obd_capa {
-       struct list_head        c_list;         /* link to capa_list */
-
-       struct lustre_capa      c_capa;         /* capa */
-       atomic_t                c_refc;         /* ref count */
-       cfs_time_t              c_expiry;       /* jiffies */
-       spinlock_t              c_lock; /* protect capa content */
-       int                     c_site;
-
-       union {
-               struct client_capa      cli;
-               struct target_capa      tgt;
-       } u;
-};
-
-enum {
-        CAPA_SITE_CLIENT = 0,
-        CAPA_SITE_SERVER,
-        CAPA_SITE_MAX
-};
-
-static inline struct lu_fid *capa_fid(struct lustre_capa *capa)
-{
-        return &capa->lc_fid;
-}
-
-static inline __u64 capa_opc(struct lustre_capa *capa)
-{
-        return capa->lc_opc;
-}
-
-static inline __u64 capa_uid(struct lustre_capa *capa)
-{
-        return capa->lc_uid;
-}
-
-static inline __u64 capa_gid(struct lustre_capa *capa)
-{
-        return capa->lc_gid;
-}
-
-static inline __u32 capa_flags(struct lustre_capa *capa)
-{
-        return capa->lc_flags & 0xffffff;
-}
-
-static inline __u32 capa_alg(struct lustre_capa *capa)
-{
-        return (capa->lc_flags >> 24);
-}
-
-static inline __u32 capa_keyid(struct lustre_capa *capa)
-{
-        return capa->lc_keyid;
-}
-
-static inline __u64 capa_key_seq(struct lustre_capa_key *key)
-{
-        return key->lk_seq;
-}
-
-static inline __u32 capa_key_keyid(struct lustre_capa_key *key)
-{
-        return key->lk_keyid;
-}
-
-static inline __u32 capa_timeout(struct lustre_capa *capa)
-{
-        return capa->lc_timeout;
-}
-
-static inline __u32 capa_expiry(struct lustre_capa *capa)
-{
-        return capa->lc_expiry;
-}
-
-void _debug_capa(struct lustre_capa *, struct libcfs_debug_msg_data *,
-                 const char *fmt, ... );
-#define DEBUG_CAPA(level, capa, fmt, args...)                                  \
-do {                                                                           \
-        if (((level) & D_CANTMASK) != 0 ||                                     \
-            ((libcfs_debug & (level)) != 0 &&                                  \
-             (libcfs_subsystem_debug & DEBUG_SUBSYSTEM) != 0)) {               \
-                LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, level, NULL);              \
-                _debug_capa((capa), &msgdata, fmt, ##args);                    \
-        }                                                                      \
-} while (0)
-
-#define DEBUG_CAPA_KEY(level, k, fmt, args...)                                 \
-do {                                                                           \
-CDEBUG(level, fmt " capability key@%p seq "LPU64" keyid %u\n",                 \
-       ##args, k, capa_key_seq(k), capa_key_keyid(k));                         \
-} while (0)
-
-typedef int (* renew_capa_cb_t)(struct obd_capa *, struct lustre_capa *);
-
-/* obdclass/capa.c */
-extern struct list_head capa_list[];
-extern spinlock_t capa_lock;
-extern int capa_count[];
-extern struct kmem_cache *capa_cachep;
-
-struct hlist_head *init_capa_hash(void);
-void cleanup_capa_hash(struct hlist_head *hash);
-
-struct obd_capa *capa_add(struct hlist_head *hash,
-                          struct lustre_capa *capa);
-struct obd_capa *capa_lookup(struct hlist_head *hash,
-                             struct lustre_capa *capa, int alive);
-
-int capa_hmac(__u8 *hmac, struct lustre_capa *capa, __u8 *key);
-int capa_encrypt_id(__u32 *d, __u32 *s, __u8 *key, int keylen);
-int capa_decrypt_id(__u32 *d, __u32 *s, __u8 *key, int keylen);
-void capa_cpy(void *dst, struct obd_capa *ocapa);
-static inline struct obd_capa *alloc_capa(int site)
-{
-        struct obd_capa *ocapa;
-
-        if (unlikely(site != CAPA_SITE_CLIENT && site != CAPA_SITE_SERVER))
-                return ERR_PTR(-EINVAL);
-
-        OBD_SLAB_ALLOC_PTR(ocapa, capa_cachep);
-        if (unlikely(!ocapa))
-                return ERR_PTR(-ENOMEM);
-
-       INIT_LIST_HEAD(&ocapa->c_list);
-       atomic_set(&ocapa->c_refc, 1);
-       spin_lock_init(&ocapa->c_lock);
-       ocapa->c_site = site;
-       if (ocapa->c_site == CAPA_SITE_CLIENT)
-               INIT_LIST_HEAD(&ocapa->u.cli.lli_list);
-       else
-               INIT_HLIST_NODE(&ocapa->u.tgt.c_hash);
-
-       return ocapa;
-}
-
-static inline struct obd_capa *capa_get(struct obd_capa *ocapa)
-{
-       if (!ocapa)
-               return NULL;
-
-       atomic_inc(&ocapa->c_refc);
-       return ocapa;
-}
-
-static inline void capa_put(struct obd_capa *ocapa)
-{
-       if (!ocapa)
-               return;
-
-       if (atomic_read(&ocapa->c_refc) == 0) {
-               DEBUG_CAPA(D_ERROR, &ocapa->c_capa, "refc is 0 for");
-               LBUG();
-       }
-
-       if (atomic_dec_and_test(&ocapa->c_refc)) {
-               LASSERT(list_empty(&ocapa->c_list));
-               if (ocapa->c_site == CAPA_SITE_CLIENT) {
-                       LASSERT(list_empty(&ocapa->u.cli.lli_list));
-               } else {
-                       struct hlist_node *hnode;
-
-                        hnode = &ocapa->u.tgt.c_hash;
-                        LASSERT(!hnode->next && !hnode->pprev);
-                }
-                OBD_SLAB_FREE(ocapa, capa_cachep, sizeof(*ocapa));
-        }
-}
-
-static inline int open_flags_to_accmode(int flags)
-{
-        int mode = flags;
-
-        if ((mode + 1) & O_ACCMODE)
-                mode++;
-        if (mode & O_TRUNC)
-                mode |= 2;
-
-        return mode;
-}
-
-static inline __u64 capa_open_opc(int mode)
-{
-        return mode & FMODE_WRITE ? CAPA_OPC_OSS_WRITE : CAPA_OPC_OSS_READ;
-}
-
-static inline void set_capa_expiry(struct obd_capa *ocapa)
-{
-        cfs_time_t expiry = cfs_time_sub((cfs_time_t)ocapa->c_capa.lc_expiry,
-                                         cfs_time_current_sec());
-        ocapa->c_expiry = cfs_time_add(cfs_time_current(),
-                                       cfs_time_seconds(expiry));
-}
-
-static inline int capa_is_expired_sec(struct lustre_capa *capa)
-{
-        return (capa->lc_expiry - cfs_time_current_sec() <= 0);
-}
-
-static inline int capa_is_expired(struct obd_capa *ocapa)
-{
-        return cfs_time_beforeq(ocapa->c_expiry, cfs_time_current());
-}
-
-static inline int capa_opc_supported(struct lustre_capa *capa, __u64 opc)
-{
-        return (capa_opc(capa) & opc) == opc;
-}
-
-struct filter_capa_key {
-       struct list_head        k_list;
-       struct lustre_capa_key  k_key;
-};
-
-enum lc_auth_id {
-       LC_ID_NONE      = 0,
-       LC_ID_PLAIN     = 1,
-       LC_ID_CONVERT   = 2
-};
-
-enum {
-       LU_CAPAINFO_MAX = 5
-};
-
-/** there are at most 5 FIDs in one operation, see rename,
- *  NOTE the last one is a temporary one used for is_subdir() */
-struct lu_capainfo {
-       enum lc_auth_id          lci_auth;
-       __u32                    lci_padding;
-       struct lu_fid            lci_fid[LU_CAPAINFO_MAX];
-       struct lustre_capa      *lci_capa[LU_CAPAINFO_MAX];
-};
-
-int  lu_capainfo_init(void);
-void lu_capainfo_fini(void);
-struct lu_capainfo *lu_capainfo_get(const struct lu_env *env);
-
-/** @} capa */
-
-#endif /* __LINUX_CAPA_H_ */
index 156d47b..d19e0b2 100644 (file)
@@ -52,7 +52,6 @@
 #include <lustre_fld.h>
 #include <lustre_handles.h>
 #include <lustre_intent.h>
 #include <lustre_fld.h>
 #include <lustre_handles.h>
 #include <lustre_intent.h>
-#include <lustre_capa.h>
 #include <lvfs.h>
 
 #define MAX_OBD_DEVICES 8192
 #include <lvfs.h>
 
 #define MAX_OBD_DEVICES 8192
@@ -656,7 +655,6 @@ enum obd_cleanup_stage {
 
 /* get/set_info keys */
 #define KEY_ASYNC               "async"
 
 /* get/set_info keys */
 #define KEY_ASYNC               "async"
-#define KEY_CAPA_KEY            "capa_key"
 #define KEY_CHANGELOG_CLEAR     "changelog_clear"
 #define KEY_FID2PATH            "fid2path"
 #define KEY_CHECKSUM            "checksum"
 #define KEY_CHANGELOG_CLEAR     "changelog_clear"
 #define KEY_FID2PATH            "fid2path"
 #define KEY_CHECKSUM            "checksum"
@@ -766,10 +764,6 @@ struct md_op_data {
 
        enum md_op_flags        op_flags;
 
 
        enum md_op_flags        op_flags;
 
-       /* Capa fields */
-       struct obd_capa        *op_capa1;
-       struct obd_capa        *op_capa2;
-
        /* Various operation flags. */
        enum mds_op_bias        op_bias;
 
        /* Various operation flags. */
        enum mds_op_bias        op_bias;
 
@@ -921,8 +915,6 @@ struct lustre_md {
        struct posix_acl        *posix_acl;
 #endif
        struct mdt_remote_perm  *remote_perm;
        struct posix_acl        *posix_acl;
 #endif
        struct mdt_remote_perm  *remote_perm;
-       struct obd_capa         *mds_capa;
-       struct obd_capa         *oss_capa;
 };
 
 struct md_open_data {
 };
 
 struct md_open_data {
@@ -991,7 +983,7 @@ struct md_ops {
                         size_t , struct ptlrpc_request **);
 
        int (*m_fsync)(struct obd_export *, const struct lu_fid *,
                         size_t , struct ptlrpc_request **);
 
        int (*m_fsync)(struct obd_export *, const struct lu_fid *,
-                      struct obd_capa *, struct ptlrpc_request **);
+                      struct ptlrpc_request **);
 
        int (*m_read_page)(struct obd_export *, struct md_op_data *,
                           struct md_callback *cb_op, __u64 hash_offset,
 
        int (*m_read_page)(struct obd_export *, struct md_op_data *,
                           struct md_callback *cb_op, __u64 hash_offset,
@@ -1001,13 +993,11 @@ struct md_ops {
                        struct ptlrpc_request **);
 
        int (*m_setxattr)(struct obd_export *, const struct lu_fid *,
                        struct ptlrpc_request **);
 
        int (*m_setxattr)(struct obd_export *, const struct lu_fid *,
-                         struct obd_capa *, u64, const char *,
-                         const char *, int, int, int, __u32,
+                         u64, const char *, const char *, int, int, int, u32,
                          struct ptlrpc_request **);
 
        int (*m_getxattr)(struct obd_export *, const struct lu_fid *,
                          struct ptlrpc_request **);
 
        int (*m_getxattr)(struct obd_export *, const struct lu_fid *,
-                         struct obd_capa *, u64, const char *,
-                         const char *, int, int, int,
+                         u64, const char *, const char *, int, int, int,
                          struct ptlrpc_request **);
 
         int (*m_intent_getattr_async)(struct obd_export *,
                          struct ptlrpc_request **);
 
         int (*m_intent_getattr_async)(struct obd_export *,
@@ -1019,9 +1009,7 @@ struct md_ops {
 
 #define MD_STATS_LAST_OP m_revalidate_lock
 
 
 #define MD_STATS_LAST_OP m_revalidate_lock
 
-       int (*m_getstatus)(struct obd_export *, struct lu_fid *,
-                          struct obd_capa **);
-
+       int (*m_getstatus)(struct obd_export *, struct lu_fid *);
        int (*m_null_inode)(struct obd_export *, const struct lu_fid *);
 
        int (*m_find_cbdata)(struct obd_export *, const struct lu_fid *,
        int (*m_null_inode)(struct obd_export *, const struct lu_fid *);
 
        int (*m_find_cbdata)(struct obd_export *, const struct lu_fid *,
@@ -1060,15 +1048,8 @@ struct md_ops {
                               ldlm_policy_data_t *, ldlm_mode_t,
                               ldlm_cancel_flags_t flags, void *opaque);
 
                               ldlm_policy_data_t *, ldlm_mode_t,
                               ldlm_cancel_flags_t flags, void *opaque);
 
-       int (*m_renew_capa)(struct obd_export *, struct obd_capa *oc,
-                           renew_capa_cb_t cb);
-
-       int (*m_unpack_capa)(struct obd_export *, struct ptlrpc_request *,
-                            const struct req_msg_field *, struct obd_capa **);
-
        int (*m_get_remote_perm)(struct obd_export *, const struct lu_fid *,
        int (*m_get_remote_perm)(struct obd_export *, const struct lu_fid *,
-                                struct obd_capa *, __u32,
-                                struct ptlrpc_request **);
+                                u32, struct ptlrpc_request **);
 
        int (*m_get_fid_from_lsm)(struct obd_export *,
                                  const struct lmv_stripe_md *,
 
        int (*m_get_fid_from_lsm)(struct obd_export *,
                                  const struct lmv_stripe_md *,
index 8c8a7c9..d92d66b 100644 (file)
@@ -1291,16 +1291,16 @@ static inline int obd_register_observer(struct obd_device *obd,
 }
 
 /* metadata helpers */
 }
 
 /* metadata helpers */
-static inline int md_getstatus(struct obd_export *exp,
-                               struct lu_fid *fid, struct obd_capa **pc)
+static inline int md_getstatus(struct obd_export *exp, struct lu_fid *fid)
 {
 {
-        int rc;
-        ENTRY;
+       int rc;
 
 
-        EXP_CHECK_MD_OP(exp, getstatus);
-        EXP_MD_COUNTER_INCREMENT(exp, getstatus);
-        rc = MDP(exp->exp_obd, getstatus)(exp, fid, pc);
-        RETURN(rc);
+       ENTRY;
+       EXP_CHECK_MD_OP(exp, getstatus);
+       EXP_MD_COUNTER_INCREMENT(exp, getstatus);
+       rc = MDP(exp->exp_obd, getstatus)(exp, fid);
+
+       RETURN(rc);
 }
 
 static inline int md_getattr(struct obd_export *exp, struct md_op_data *op_data,
 }
 
 static inline int md_getattr(struct obd_export *exp, struct md_op_data *op_data,
@@ -1445,13 +1445,15 @@ static inline int md_setattr(struct obd_export *exp, struct md_op_data *op_data,
 }
 
 static inline int md_fsync(struct obd_export *exp, const struct lu_fid *fid,
 }
 
 static inline int md_fsync(struct obd_export *exp, const struct lu_fid *fid,
-                          struct obd_capa *oc, struct ptlrpc_request **request)
+                          struct ptlrpc_request **request)
 {
        int rc;
 {
        int rc;
+
        ENTRY;
        EXP_CHECK_MD_OP(exp, fsync);
        EXP_MD_COUNTER_INCREMENT(exp, fsync);
        ENTRY;
        EXP_CHECK_MD_OP(exp, fsync);
        EXP_MD_COUNTER_INCREMENT(exp, fsync);
-       rc = MDP(exp->exp_obd, fsync)(exp, fid, oc, request);
+       rc = MDP(exp->exp_obd, fsync)(exp, fid, request);
+
        RETURN(rc);
 }
 
        RETURN(rc);
 }
 
@@ -1513,34 +1515,32 @@ static inline int md_merge_attr(struct obd_export *exp,
        RETURN(MDP(exp->exp_obd, merge_attr)(exp, lsm, attr, cb));
 }
 
        RETURN(MDP(exp->exp_obd, merge_attr)(exp, lsm, attr, cb));
 }
 
-static inline int md_setxattr(struct obd_export *exp,
-                             const struct lu_fid *fid, struct obd_capa *oc,
+static inline int md_setxattr(struct obd_export *exp, const struct lu_fid *fid,
                              u64 valid, const char *name,
                              const char *input, int input_size,
                              int output_size, int flags, __u32 suppgid,
                              struct ptlrpc_request **request)
 {
                              u64 valid, const char *name,
                              const char *input, int input_size,
                              int output_size, int flags, __u32 suppgid,
                              struct ptlrpc_request **request)
 {
-        ENTRY;
-        EXP_CHECK_MD_OP(exp, setxattr);
-        EXP_MD_COUNTER_INCREMENT(exp, setxattr);
-        RETURN(MDP(exp->exp_obd, setxattr)(exp, fid, oc, valid, name, input,
-                                           input_size, output_size, flags,
-                                           suppgid, request));
+       ENTRY;
+       EXP_CHECK_MD_OP(exp, setxattr);
+       EXP_MD_COUNTER_INCREMENT(exp, setxattr);
+       RETURN(MDP(exp->exp_obd, setxattr)(exp, fid, valid, name, input,
+                                          input_size, output_size, flags,
+                                          suppgid, request));
 }
 
 }
 
-static inline int md_getxattr(struct obd_export *exp,
-                             const struct lu_fid *fid, struct obd_capa *oc,
+static inline int md_getxattr(struct obd_export *exp, const struct lu_fid *fid,
                              u64 valid, const char *name,
                              const char *input, int input_size,
                              int output_size, int flags,
                              struct ptlrpc_request **request)
 {
                              u64 valid, const char *name,
                              const char *input, int input_size,
                              int output_size, int flags,
                              struct ptlrpc_request **request)
 {
-        ENTRY;
-        EXP_CHECK_MD_OP(exp, getxattr);
-        EXP_MD_COUNTER_INCREMENT(exp, getxattr);
-        RETURN(MDP(exp->exp_obd, getxattr)(exp, fid, oc, valid, name, input,
-                                           input_size, output_size, flags,
-                                           request));
+       ENTRY;
+       EXP_CHECK_MD_OP(exp, getxattr);
+       EXP_MD_COUNTER_INCREMENT(exp, getxattr);
+       RETURN(MDP(exp->exp_obd, getxattr)(exp, fid, valid, name, input,
+                                          input_size, output_size, flags,
+                                          request));
 }
 
 static inline int md_set_open_replay_data(struct obd_export *exp,
 }
 
 static inline int md_set_open_replay_data(struct obd_export *exp,
@@ -1613,39 +1613,14 @@ static inline int md_init_ea_size(struct obd_export *exp, __u32 ea_size,
 }
 
 static inline int md_get_remote_perm(struct obd_export *exp,
 }
 
 static inline int md_get_remote_perm(struct obd_export *exp,
-                                     const struct lu_fid *fid,
-                                     struct obd_capa *oc, __u32 suppgid,
-                                     struct ptlrpc_request **request)
+                                    const struct lu_fid *fid, u32 suppgid,
+                                    struct ptlrpc_request **request)
 {
 {
-        ENTRY;
-        EXP_CHECK_MD_OP(exp, get_remote_perm);
-        EXP_MD_COUNTER_INCREMENT(exp, get_remote_perm);
-        RETURN(MDP(exp->exp_obd, get_remote_perm)(exp, fid, oc, suppgid,
-                                                  request));
-}
-
-static inline int md_renew_capa(struct obd_export *exp, struct obd_capa *ocapa,
-                                renew_capa_cb_t cb)
-{
-        int rc;
-        ENTRY;
-        EXP_CHECK_MD_OP(exp, renew_capa);
-        EXP_MD_COUNTER_INCREMENT(exp, renew_capa);
-        rc = MDP(exp->exp_obd, renew_capa)(exp, ocapa, cb);
-        RETURN(rc);
-}
+       ENTRY;
+       EXP_CHECK_MD_OP(exp, get_remote_perm);
+       EXP_MD_COUNTER_INCREMENT(exp, get_remote_perm);
 
 
-static inline int md_unpack_capa(struct obd_export *exp,
-                                 struct ptlrpc_request *req,
-                                 const struct req_msg_field *field,
-                                 struct obd_capa **oc)
-{
-        int rc;
-        ENTRY;
-        EXP_CHECK_MD_OP(exp, unpack_capa);
-        EXP_MD_COUNTER_INCREMENT(exp, unpack_capa);
-        rc = MDP(exp->exp_obd, unpack_capa)(exp, req, field, oc);
-        RETURN(rc);
+       RETURN(MDP(exp->exp_obd, get_remote_perm)(exp, fid, suppgid, request));
 }
 
 static inline int md_intent_getattr_async(struct obd_export *exp,
 }
 
 static inline int md_intent_getattr_async(struct obd_export *exp,
index 3d02d1d..fb92688 100644 (file)
@@ -2,7 +2,7 @@ MODULES := lustre
 @LLITE_LLOOP_TRUE@MODULES += llite_lloop
 lustre-objs := dcache.o dir.o file.o llite_lib.o llite_nfs.o
 lustre-objs += rw.o lproc_llite.o namei.o symlink.o llite_mmap.o
 @LLITE_LLOOP_TRUE@MODULES += llite_lloop
 lustre-objs := dcache.o dir.o file.o llite_lib.o llite_nfs.o
 lustre-objs += rw.o lproc_llite.o namei.o symlink.o llite_mmap.o
-lustre-objs += xattr.o xattr_cache.o remote_perm.o llite_rmtacl.o llite_capa.o
+lustre-objs += xattr.o xattr_cache.o remote_perm.o llite_rmtacl.o
 lustre-objs += rw26.o super25.o statahead.o
 lustre-objs += glimpse.o
 lustre-objs += lcommon_cl.o
 lustre-objs += rw26.o super25.o statahead.o
 lustre-objs += glimpse.o
 lustre-objs += lcommon_cl.o
index 471ef97..715e4ea 100644 (file)
@@ -99,7 +99,6 @@ void ll_pack_inode2opdata(struct inode *inode, struct md_op_data *op_data,
        op_data->op_attr_flags = ll_inode_to_ext_flags(inode->i_flags);
         if (fh)
                 op_data->op_handle = *fh;
        op_data->op_attr_flags = ll_inode_to_ext_flags(inode->i_flags);
         if (fh)
                 op_data->op_handle = *fh;
-        op_data->op_capa1 = ll_mdscapa_get(inode);
 
        if (LLIF_DATA_MODIFIED & ll_i2info(inode)->lli_flags)
                op_data->op_bias |= MDS_DATA_MODIFIED;
 
        if (LLIF_DATA_MODIFIED & ll_i2info(inode)->lli_flags)
                op_data->op_bias |= MDS_DATA_MODIFIED;
@@ -332,7 +331,6 @@ static int ll_md_close(struct obd_export *md_exp, struct inode *inode,
 out:
        LUSTRE_FPRIVATE(file) = NULL;
        ll_file_data_put(fd);
 out:
        LUSTRE_FPRIVATE(file) = NULL;
        ll_file_data_put(fd);
-       ll_capa_close(inode);
 
        RETURN(rc);
 }
 
        RETURN(rc);
 }
@@ -673,8 +671,6 @@ restart:
         if (!S_ISREG(inode->i_mode))
                 GOTO(out_och_free, rc);
 
         if (!S_ISREG(inode->i_mode))
                 GOTO(out_och_free, rc);
 
-        ll_capa_open(inode);
-
        cl_lov_delay_create_clear(&file->f_flags);
        GOTO(out_och_free, rc);
 
        cl_lov_delay_create_clear(&file->f_flags);
        GOTO(out_och_free, rc);
 
@@ -2669,7 +2665,6 @@ int ll_fsync(struct file *file, struct dentry *dentry, int datasync)
        struct inode *inode = dentry->d_inode;
        struct ll_inode_info *lli = ll_i2info(inode);
        struct ptlrpc_request *req;
        struct inode *inode = dentry->d_inode;
        struct ll_inode_info *lli = ll_i2info(inode);
        struct ptlrpc_request *req;
-       struct obd_capa *oc;
        int rc, err;
        ENTRY;
 
        int rc, err;
        ENTRY;
 
@@ -2698,10 +2693,7 @@ int ll_fsync(struct file *file, struct dentry *dentry, int datasync)
                        rc = err;
        }
 
                        rc = err;
        }
 
-       oc = ll_mdscapa_get(inode);
-       err = md_fsync(ll_i2sbi(inode)->ll_md_exp, ll_inode2fid(inode), oc,
-                      &req);
-       capa_put(oc);
+       err = md_fsync(ll_i2sbi(inode)->ll_md_exp, ll_inode2fid(inode), &req);
        if (!rc)
                rc = err;
        if (!err)
        if (!rc)
                rc = err;
        if (!err)
@@ -3143,9 +3135,6 @@ static int __ll_inode_revalidate(struct dentry *dentry, __u64 ibits)
                         RETURN(PTR_ERR(op_data));
 
                 op_data->op_valid = valid;
                         RETURN(PTR_ERR(op_data));
 
                 op_data->op_valid = valid;
-                /* Once OBD_CONNECT_ATTRFID is not supported, we can't find one
-                 * capa for this inode. Because we only keep capas of dirs
-                 * fresh. */
                 rc = md_getattr(sbi->ll_md_exp, op_data, &req);
                 ll_finish_md_op_data(op_data);
                 if (rc) {
                 rc = md_getattr(sbi->ll_md_exp, op_data, &req);
                 ll_finish_md_op_data(op_data);
                 if (rc) {
@@ -3645,7 +3634,6 @@ static int ll_layout_fetch(struct inode *inode, struct ldlm_lock *lock)
 
 {
        struct ll_sb_info *sbi = ll_i2sbi(inode);
 
 {
        struct ll_sb_info *sbi = ll_i2sbi(inode);
-       struct obd_capa *oc;
        struct ptlrpc_request *req;
        struct mdt_body *body;
        void *lvbdata;
        struct ptlrpc_request *req;
        struct mdt_body *body;
        void *lvbdata;
@@ -3666,13 +3654,11 @@ static int ll_layout_fetch(struct inode *inode, struct ldlm_lock *lock)
         * blocked and then granted via completion ast, we have to fetch
         * layout here. Please note that we can't use the LVB buffer in
         * completion AST because it doesn't have a large enough buffer */
         * blocked and then granted via completion ast, we have to fetch
         * layout here. Please note that we can't use the LVB buffer in
         * completion AST because it doesn't have a large enough buffer */
-       oc = ll_mdscapa_get(inode);
        rc = ll_get_default_mdsize(sbi, &lmmsize);
        if (rc == 0)
        rc = ll_get_default_mdsize(sbi, &lmmsize);
        if (rc == 0)
-               rc = md_getxattr(sbi->ll_md_exp, ll_inode2fid(inode), oc,
+               rc = md_getxattr(sbi->ll_md_exp, ll_inode2fid(inode),
                                OBD_MD_FLXATTR, XATTR_NAME_LOV, NULL, 0,
                                lmmsize, 0, &req);
                                OBD_MD_FLXATTR, XATTR_NAME_LOV, NULL, 0,
                                lmmsize, 0, &req);
-       capa_put(oc);
        if (rc < 0)
                RETURN(rc);
 
        if (rc < 0)
                RETURN(rc);
 
diff --git a/lustre/llite/llite_capa.c b/lustre/llite/llite_capa.c
deleted file mode 100644 (file)
index f8ec905..0000000
+++ /dev/null
@@ -1,606 +0,0 @@
-/*
- * 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 (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Use is subject to license terms.
- *
- * Copyright (c) 2012, 2014, Intel Corporation.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
- *
- * lustre/llite/llite_capa.c
- *
- * Author: Lai Siyao <lsy@clusterfs.com>
- */
-
-#define DEBUG_SUBSYSTEM S_LLITE
-
-#include <linux/fs.h>
-#include <linux/version.h>
-#include <linux/kthread.h>
-#include <asm/uaccess.h>
-#include <linux/file.h>
-#include <linux/kmod.h>
-
-#include "llite_internal.h"
-
-/* for obd_capa.c_list, client capa might stay in three places:
- * 1. ll_capa_list.
- * 2. ll_idle_capas.
- * 3. stand alone: just allocated.
- */
-
-/* capas for oss writeback and those failed to renew */
-static struct list_head ll_idle_capas = LIST_HEAD_INIT(ll_idle_capas);
-static struct ptlrpc_thread ll_capa_thread;
-static struct list_head *ll_capa_list = &capa_list[CAPA_SITE_CLIENT];
-
-/* llite capa renewal timer */
-struct timer_list ll_capa_timer;
-/* for debug: indicate whether capa on llite is enabled or not */
-static atomic_t ll_capa_debug = ATOMIC_INIT(0);
-static unsigned long long ll_capa_renewed = 0;
-static unsigned long long ll_capa_renewal_noent = 0;
-static unsigned long long ll_capa_renewal_failed = 0;
-static unsigned long long ll_capa_renewal_retries = 0;
-
-static int ll_update_capa(struct obd_capa *ocapa, struct lustre_capa *capa);
-
-static inline void update_capa_timer(struct obd_capa *ocapa, cfs_time_t expiry)
-{
-        if (cfs_time_before(expiry, ll_capa_timer.expires) ||
-            !timer_pending(&ll_capa_timer)) {
-                mod_timer(&ll_capa_timer, expiry);
-                DEBUG_CAPA(D_SEC, &ocapa->c_capa,
-                           "ll_capa_timer update: %lu/%lu by", expiry, jiffies);
-        }
-}
-
-static inline cfs_time_t capa_renewal_time(struct obd_capa *ocapa)
-{
-        return cfs_time_sub(ocapa->c_expiry,
-                            cfs_time_seconds(ocapa->c_capa.lc_timeout) / 2);
-}
-
-static inline int capa_is_to_expire(struct obd_capa *ocapa)
-{
-        return cfs_time_beforeq(capa_renewal_time(ocapa), cfs_time_current());
-}
-
-static inline int have_expired_capa(void)
-{
-       struct obd_capa *ocapa = NULL;
-       int expired = 0;
-
-       /* if ll_capa_list has client capa to expire or ll_idle_capas has
-        * expired capa, return 1.
-        */
-       spin_lock(&capa_lock);
-       if (!list_empty(ll_capa_list)) {
-               ocapa = list_entry(ll_capa_list->next, struct obd_capa,
-                                       c_list);
-                expired = capa_is_to_expire(ocapa);
-                if (!expired)
-                        update_capa_timer(ocapa, capa_renewal_time(ocapa));
-       } else if (!list_empty(&ll_idle_capas)) {
-               ocapa = list_entry(ll_idle_capas.next, struct obd_capa,
-                                       c_list);
-                expired = capa_is_expired(ocapa);
-                if (!expired)
-                        update_capa_timer(ocapa, ocapa->c_expiry);
-        }
-       spin_unlock(&capa_lock);
-
-       if (expired)
-               DEBUG_CAPA(D_SEC, &ocapa->c_capa, "expired");
-       return expired;
-}
-
-static void sort_add_capa(struct obd_capa *ocapa, struct list_head *head)
-{
-        struct obd_capa *tmp;
-       struct list_head *before = NULL;
-
-        /* TODO: client capa is sorted by expiry, this could be optimized */
-       list_for_each_entry_reverse(tmp, head, c_list) {
-                if (cfs_time_aftereq(ocapa->c_expiry, tmp->c_expiry)) {
-                        before = &tmp->c_list;
-                        break;
-                }
-        }
-
-        LASSERT(&ocapa->c_list != before);
-       list_add(&ocapa->c_list, before ?: head);
-}
-
-static inline int obd_capa_open_count(struct obd_capa *oc)
-{
-       struct ll_inode_info *lli = ll_i2info(oc->u.cli.inode);
-       return atomic_read(&lli->lli_open_count);
-}
-
-static void ll_delete_capa(struct obd_capa *ocapa)
-{
-        struct ll_inode_info *lli = ll_i2info(ocapa->u.cli.inode);
-
-        if (capa_for_mds(&ocapa->c_capa)) {
-                LASSERT(lli->lli_mds_capa == ocapa);
-                lli->lli_mds_capa = NULL;
-        } else if (capa_for_oss(&ocapa->c_capa)) {
-               list_del_init(&ocapa->u.cli.lli_list);
-        }
-
-        DEBUG_CAPA(D_SEC, &ocapa->c_capa, "free client");
-       list_del_init(&ocapa->c_list);
-        capa_count[CAPA_SITE_CLIENT]--;
-        /* release the ref when alloc */
-        capa_put(ocapa);
-}
-
-/* three places where client capa is deleted:
- * 1. capa_thread_main(), main place to delete expired capa.
- * 2. ll_clear_inode_capas() in ll_clear_inode().
- * 3. ll_truncate_free_capa() delete truncate capa explicitly in ll_setattr_ost().
- */
-static int capa_thread_main(void *unused)
-{
-       struct obd_capa *ocapa, *tmp, *next;
-       struct inode *inode = NULL;
-       struct l_wait_info lwi = { 0 };
-       int rc;
-       ENTRY;
-
-       thread_set_flags(&ll_capa_thread, SVC_RUNNING);
-       wake_up(&ll_capa_thread.t_ctl_waitq);
-
-       while (1) {
-               l_wait_event(ll_capa_thread.t_ctl_waitq,
-                            !thread_is_running(&ll_capa_thread) ||
-                            have_expired_capa(),
-                            &lwi);
-
-                if (!thread_is_running(&ll_capa_thread))
-                        break;
-
-                next = NULL;
-
-               spin_lock(&capa_lock);
-               list_for_each_entry_safe(ocapa, tmp, ll_capa_list, c_list) {
-                        __u64 ibits;
-
-                        LASSERT(ocapa->c_capa.lc_opc != CAPA_OPC_OSS_TRUNC);
-
-                        if (!capa_is_to_expire(ocapa)) {
-                                next = ocapa;
-                                break;
-                        }
-
-                       list_del_init(&ocapa->c_list);
-
-                        /* for MDS capability, only renew those which belong to
-                         * dir, or its inode is opened, or client holds LOOKUP
-                         * lock.
-                         */
-                        /* ibits may be changed by ll_have_md_lock() so we have
-                         * to set it each time */
-                        ibits = MDS_INODELOCK_LOOKUP;
-                        if (capa_for_mds(&ocapa->c_capa) &&
-                            !S_ISDIR(ocapa->u.cli.inode->i_mode) &&
-                            obd_capa_open_count(ocapa) == 0 &&
-                            !ll_have_md_lock(ocapa->u.cli.inode,
-                                             &ibits, LCK_MINMODE)) {
-                                DEBUG_CAPA(D_SEC, &ocapa->c_capa,
-                                           "skip renewal for");
-                                sort_add_capa(ocapa, &ll_idle_capas);
-                                continue;
-                        }
-
-                        /* for OSS capability, only renew those whose inode is
-                         * opened.
-                         */
-                        if (capa_for_oss(&ocapa->c_capa) &&
-                            obd_capa_open_count(ocapa) == 0) {
-                                /* oss capa with open count == 0 won't renew,
-                                 * move to idle list */
-                                sort_add_capa(ocapa, &ll_idle_capas);
-                                continue;
-                        }
-
-                        /* NB iput() is in ll_update_capa() */
-                        inode = igrab(ocapa->u.cli.inode);
-                        if (inode == NULL) {
-                                DEBUG_CAPA(D_ERROR, &ocapa->c_capa,
-                                           "igrab failed for");
-                                continue;
-                        }
-
-                        capa_get(ocapa);
-                        ll_capa_renewed++;
-                       spin_unlock(&capa_lock);
-                       rc = md_renew_capa(ll_i2mdexp(inode), ocapa,
-                                          ll_update_capa);
-                       spin_lock(&capa_lock);
-                        if (rc) {
-                                DEBUG_CAPA(D_ERROR, &ocapa->c_capa,
-                                           "renew failed: %d", rc);
-                                ll_capa_renewal_failed++;
-                        }
-                }
-
-                if (next)
-                        update_capa_timer(next, capa_renewal_time(next));
-
-               list_for_each_entry_safe(ocapa, tmp, &ll_idle_capas,
-                                             c_list) {
-                        if (!capa_is_expired(ocapa)) {
-                                if (!next)
-                                        update_capa_timer(ocapa,
-                                                          ocapa->c_expiry);
-                               break;
-                       }
-
-                       if (atomic_read(&ocapa->c_refc) > 1) {
-                               DEBUG_CAPA(D_SEC, &ocapa->c_capa,
-                                          "expired(c_refc %d), don't release",
-                                          atomic_read(&ocapa->c_refc));
-                               /* don't try to renew any more */
-                               list_del_init(&ocapa->c_list);
-                               continue;
-                       }
-
-                        /* expired capa is released. */
-                        DEBUG_CAPA(D_SEC, &ocapa->c_capa, "release expired");
-                        ll_delete_capa(ocapa);
-                }
-
-               spin_unlock(&capa_lock);
-       }
-
-       thread_set_flags(&ll_capa_thread, SVC_STOPPED);
-       wake_up(&ll_capa_thread.t_ctl_waitq);
-       RETURN(0);
-}
-
-void ll_capa_timer_callback(unsigned long unused)
-{
-       wake_up(&ll_capa_thread.t_ctl_waitq);
-}
-
-int ll_capa_thread_start(void)
-{
-       struct task_struct *task;
-       ENTRY;
-
-       init_waitqueue_head(&ll_capa_thread.t_ctl_waitq);
-
-       task = kthread_run(capa_thread_main, NULL, "ll_capa");
-       if (IS_ERR(task)) {
-               CERROR("cannot start expired capa thread: rc %ld\n",
-                       PTR_ERR(task));
-               RETURN(PTR_ERR(task));
-       }
-       wait_event(ll_capa_thread.t_ctl_waitq,
-                      thread_is_running(&ll_capa_thread));
-
-       RETURN(0);
-}
-
-void ll_capa_thread_stop(void)
-{
-       thread_set_flags(&ll_capa_thread, SVC_STOPPING);
-       wake_up(&ll_capa_thread.t_ctl_waitq);
-       wait_event(ll_capa_thread.t_ctl_waitq,
-                      thread_is_stopped(&ll_capa_thread));
-}
-
-struct obd_capa *ll_mdscapa_get(struct inode *inode)
-{
-       struct ll_inode_info *lli = ll_i2info(inode);
-       struct obd_capa *ocapa;
-       ENTRY;
-
-       LASSERT(inode != NULL);
-
-       if ((ll_i2sbi(inode)->ll_flags & LL_SBI_MDS_CAPA) == 0)
-               RETURN(NULL);
-
-       spin_lock(&capa_lock);
-       ocapa = capa_get(lli->lli_mds_capa);
-       spin_unlock(&capa_lock);
-       if (!ocapa && atomic_read(&ll_capa_debug)) {
-               CERROR("no mds capability for "DFID"\n", PFID(&lli->lli_fid));
-               atomic_set(&ll_capa_debug, 0);
-       }
-
-       RETURN(ocapa);
-}
-
-static struct obd_capa *do_add_mds_capa(struct inode *inode,
-                                        struct obd_capa *ocapa)
-{
-        struct ll_inode_info *lli = ll_i2info(inode);
-        struct obd_capa *old = lli->lli_mds_capa;
-        struct lustre_capa *capa = &ocapa->c_capa;
-
-        if (!old) {
-                ocapa->u.cli.inode = inode;
-                lli->lli_mds_capa = ocapa;
-                capa_count[CAPA_SITE_CLIENT]++;
-
-                DEBUG_CAPA(D_SEC, capa, "add MDS");
-        } else {
-               spin_lock(&old->c_lock);
-               old->c_capa = *capa;
-               spin_unlock(&old->c_lock);
-
-                DEBUG_CAPA(D_SEC, capa, "update MDS");
-
-                capa_put(ocapa);
-                ocapa = old;
-        }
-        return ocapa;
-}
-
-static struct obd_capa *do_lookup_oss_capa(struct inode *inode, int opc)
-{
-        struct ll_inode_info *lli = ll_i2info(inode);
-        struct obd_capa *ocapa;
-
-        /* inside capa_lock */
-       list_for_each_entry(ocapa, &lli->lli_oss_capas, u.cli.lli_list) {
-                if ((capa_opc(&ocapa->c_capa) & opc) != opc)
-                        continue;
-
-                LASSERT(lu_fid_eq(capa_fid(&ocapa->c_capa),
-                                  ll_inode2fid(inode)));
-                LASSERT(ocapa->c_site == CAPA_SITE_CLIENT);
-
-                DEBUG_CAPA(D_SEC, &ocapa->c_capa, "found client");
-                return ocapa;
-        }
-
-        return NULL;
-}
-
-static inline void inode_add_oss_capa(struct inode *inode,
-                                      struct obd_capa *ocapa)
-{
-        struct ll_inode_info *lli = ll_i2info(inode);
-        struct obd_capa *tmp;
-       struct list_head *next = NULL;
-
-        /* capa is sorted in lli_oss_capas so lookup can always find the
-         * latest one */
-       list_for_each_entry(tmp, &lli->lli_oss_capas, u.cli.lli_list) {
-                if (cfs_time_after(ocapa->c_expiry, tmp->c_expiry)) {
-                        next = &tmp->u.cli.lli_list;
-                        break;
-                }
-        }
-        LASSERT(&ocapa->u.cli.lli_list != next);
-       list_move_tail(&ocapa->u.cli.lli_list, next ?: &lli->lli_oss_capas);
-}
-
-static struct obd_capa *do_add_oss_capa(struct inode *inode,
-                                        struct obd_capa *ocapa)
-{
-        struct obd_capa *old;
-        struct lustre_capa *capa = &ocapa->c_capa;
-
-        LASSERTF(S_ISREG(inode->i_mode),
-                 "inode has oss capa, but not regular file, mode: %d\n",
-                 inode->i_mode);
-
-        /* FIXME: can't replace it so easily with fine-grained opc */
-        old = do_lookup_oss_capa(inode, capa_opc(capa) & CAPA_OPC_OSS_ONLY);
-        if (!old) {
-                ocapa->u.cli.inode = inode;
-               INIT_LIST_HEAD(&ocapa->u.cli.lli_list);
-                capa_count[CAPA_SITE_CLIENT]++;
-
-                DEBUG_CAPA(D_SEC, capa, "add OSS");
-        } else {
-               spin_lock(&old->c_lock);
-               old->c_capa = *capa;
-               spin_unlock(&old->c_lock);
-
-                DEBUG_CAPA(D_SEC, capa, "update OSS");
-
-                capa_put(ocapa);
-                ocapa = old;
-        }
-
-        inode_add_oss_capa(inode, ocapa);
-        return ocapa;
-}
-
-struct obd_capa *ll_add_capa(struct inode *inode, struct obd_capa *ocapa)
-{
-       spin_lock(&capa_lock);
-       ocapa = capa_for_mds(&ocapa->c_capa) ? do_add_mds_capa(inode, ocapa) :
-                                              do_add_oss_capa(inode, ocapa);
-
-       /* truncate capa won't renew */
-       if (ocapa->c_capa.lc_opc != CAPA_OPC_OSS_TRUNC) {
-               set_capa_expiry(ocapa);
-               list_del_init(&ocapa->c_list);
-               sort_add_capa(ocapa, ll_capa_list);
-
-               update_capa_timer(ocapa, capa_renewal_time(ocapa));
-       }
-
-       spin_unlock(&capa_lock);
-
-       atomic_set(&ll_capa_debug, 1);
-       return ocapa;
-}
-
-static inline void delay_capa_renew(struct obd_capa *oc, cfs_time_t delay)
-{
-        /* NB: set a fake expiry for this capa to prevent it renew too soon */
-        oc->c_expiry = cfs_time_add(oc->c_expiry, cfs_time_seconds(delay));
-}
-
-static int ll_update_capa(struct obd_capa *ocapa, struct lustre_capa *capa)
-{
-        struct inode *inode = ocapa->u.cli.inode;
-        int rc = 0;
-        ENTRY;
-
-        LASSERT(ocapa);
-
-        if (IS_ERR(capa)) {
-                /* set error code */
-                rc = PTR_ERR(capa);
-               spin_lock(&capa_lock);
-                if (rc == -ENOENT) {
-                        DEBUG_CAPA(D_SEC, &ocapa->c_capa,
-                                   "renewal canceled because object removed");
-                        ll_capa_renewal_noent++;
-                } else {
-                        ll_capa_renewal_failed++;
-
-                        /* failed capa won't be renewed any longer, but if -EIO,
-                         * client might be doing recovery, retry in 2 min. */
-                        if (rc == -EIO && !capa_is_expired(ocapa)) {
-                                delay_capa_renew(ocapa, 120);
-                                DEBUG_CAPA(D_ERROR, &ocapa->c_capa,
-                                           "renewal failed: -EIO, "
-                                           "retry in 2 mins");
-                                ll_capa_renewal_retries++;
-                                GOTO(retry, rc);
-                        } else {
-                                DEBUG_CAPA(D_ERROR, &ocapa->c_capa,
-                                           "renewal failed(rc: %d) for", rc);
-                        }
-                }
-
-               list_del_init(&ocapa->c_list);
-                sort_add_capa(ocapa, &ll_idle_capas);
-               spin_unlock(&capa_lock);
-
-               capa_put(ocapa);
-               iput(inode);
-               RETURN(rc);
-       }
-
-       spin_lock(&ocapa->c_lock);
-       LASSERT(!memcmp(&ocapa->c_capa, capa,
-                       offsetof(struct lustre_capa, lc_opc)));
-       ocapa->c_capa = *capa;
-       set_capa_expiry(ocapa);
-       spin_unlock(&ocapa->c_lock);
-
-       spin_lock(&capa_lock);
-       if (capa_for_oss(capa))
-               inode_add_oss_capa(inode, ocapa);
-       DEBUG_CAPA(D_SEC, capa, "renew");
-       EXIT;
-retry:
-       list_del_init(&ocapa->c_list);
-       sort_add_capa(ocapa, ll_capa_list);
-       update_capa_timer(ocapa, capa_renewal_time(ocapa));
-       spin_unlock(&capa_lock);
-
-       capa_put(ocapa);
-       iput(inode);
-       return rc;
-}
-
-void ll_capa_open(struct inode *inode)
-{
-       struct ll_inode_info *lli = ll_i2info(inode);
-
-       if ((ll_i2sbi(inode)->ll_flags & (LL_SBI_MDS_CAPA | LL_SBI_OSS_CAPA))
-           == 0)
-               return;
-
-       if (!S_ISREG(inode->i_mode))
-               return;
-
-       atomic_inc(&lli->lli_open_count);
-}
-
-void ll_capa_close(struct inode *inode)
-{
-       struct ll_inode_info *lli = ll_i2info(inode);
-
-       if ((ll_i2sbi(inode)->ll_flags & (LL_SBI_MDS_CAPA | LL_SBI_OSS_CAPA))
-           == 0)
-               return;
-
-       if (!S_ISREG(inode->i_mode))
-               return;
-
-       atomic_dec(&lli->lli_open_count);
-}
-
-/* delete CAPA_OPC_OSS_TRUNC only */
-void ll_truncate_free_capa(struct obd_capa *ocapa)
-{
-        if (!ocapa)
-                return;
-
-        LASSERT(ocapa->c_capa.lc_opc & CAPA_OPC_OSS_TRUNC);
-        DEBUG_CAPA(D_SEC, &ocapa->c_capa, "free truncate");
-
-        /* release ref when find */
-        capa_put(ocapa);
-        if (likely(ocapa->c_capa.lc_opc == CAPA_OPC_OSS_TRUNC)) {
-               spin_lock(&capa_lock);
-               ll_delete_capa(ocapa);
-               spin_unlock(&capa_lock);
-       }
-}
-
-void ll_clear_inode_capas(struct inode *inode)
-{
-       struct ll_inode_info *lli = ll_i2info(inode);
-       struct obd_capa *ocapa, *tmp;
-
-       spin_lock(&capa_lock);
-       ocapa = lli->lli_mds_capa;
-       if (ocapa)
-               ll_delete_capa(ocapa);
-
-       list_for_each_entry_safe(ocapa, tmp, &lli->lli_oss_capas,
-                                    u.cli.lli_list)
-               ll_delete_capa(ocapa);
-       spin_unlock(&capa_lock);
-}
-
-void ll_print_capa_stat(struct ll_sb_info *sbi)
-{
-        if (sbi->ll_flags & (LL_SBI_MDS_CAPA | LL_SBI_OSS_CAPA))
-                LCONSOLE_INFO("Fid capabilities renewed: %llu\n"
-                              "Fid capabilities renewal ENOENT: %llu\n"
-                              "Fid capabilities failed to renew: %llu\n"
-                              "Fid capabilities renewal retries: %llu\n",
-                              ll_capa_renewed, ll_capa_renewal_noent,
-                              ll_capa_renewal_failed, ll_capa_renewal_retries);
-}
index e680051..030c468 100644 (file)
@@ -144,11 +144,9 @@ struct ll_inode_info {
        /* master inode fid for stripe directory */
        struct lu_fid                   lli_pfid;
 
        /* master inode fid for stripe directory */
        struct lu_fid                   lli_pfid;
 
-       struct list_head                lli_oss_capas;
        /* open count currently used by capability only, indicate whether
         * capability needs renewal */
        atomic_t                        lli_open_count;
        /* open count currently used by capability only, indicate whether
         * capability needs renewal */
        atomic_t                        lli_open_count;
-       struct obd_capa                *lli_mds_capa;
        cfs_time_t                      lli_rmtperm_time;
 
        /* We need all three because every inode may be opened in different
        cfs_time_t                      lli_rmtperm_time;
 
        /* We need all three because every inode may be opened in different
@@ -401,8 +399,8 @@ enum stats_track_type {
 #define LL_SBI_USER_XATTR        0x08 /* support user xattr */
 #define LL_SBI_ACL               0x10 /* support ACL */
 #define LL_SBI_RMT_CLIENT        0x40 /* remote client */
 #define LL_SBI_USER_XATTR        0x08 /* support user xattr */
 #define LL_SBI_ACL               0x10 /* support ACL */
 #define LL_SBI_RMT_CLIENT        0x40 /* remote client */
-#define LL_SBI_MDS_CAPA          0x80 /* support mds capa */
-#define LL_SBI_OSS_CAPA         0x100 /* support oss capa */
+#define LL_SBI_MDS_CAPA          0x80 /* support mds capa, obsolete */
+#define LL_SBI_OSS_CAPA         0x100 /* support oss capa, obsolete */
 #define LL_SBI_LOCALFLOCK       0x200 /* Local flocks support by kernel */
 #define LL_SBI_LRU_RESIZE       0x400 /* lru resize support */
 #define LL_SBI_LAZYSTATFS       0x800 /* lazystatfs mount option */
 #define LL_SBI_LOCALFLOCK       0x200 /* Local flocks support by kernel */
 #define LL_SBI_LRU_RESIZE       0x400 /* lru resize support */
 #define LL_SBI_LAZYSTATFS       0x800 /* lazystatfs mount option */
@@ -1110,24 +1108,6 @@ void free_rmtperm_hash(struct hlist_head *hash);
 int ll_update_remote_perm(struct inode *inode, struct mdt_remote_perm *perm);
 int lustre_check_remote_perm(struct inode *inode, int mask);
 
 int ll_update_remote_perm(struct inode *inode, struct mdt_remote_perm *perm);
 int lustre_check_remote_perm(struct inode *inode, int mask);
 
-/* llite/llite_capa.c */
-extern struct timer_list ll_capa_timer;
-
-int ll_capa_thread_start(void);
-void ll_capa_thread_stop(void);
-void ll_capa_timer_callback(unsigned long unused);
-
-struct obd_capa *ll_add_capa(struct inode *inode, struct obd_capa *ocapa);
-
-void ll_capa_open(struct inode *inode);
-void ll_capa_close(struct inode *inode);
-
-struct obd_capa *ll_mdscapa_get(struct inode *inode);
-
-void ll_truncate_free_capa(struct obd_capa *ocapa);
-void ll_clear_inode_capas(struct inode *inode);
-void ll_print_capa_stat(struct ll_sb_info *sbi);
-
 /**
  * Common IO arguments for various VFS I/O interfaces.
  */
 /**
  * Common IO arguments for various VFS I/O interfaces.
  */
index 4b5d6c3..ac62630 100644 (file)
@@ -176,7 +176,6 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
        struct inode *root = NULL;
         struct ll_sb_info *sbi = ll_s2sbi(sb);
         struct obd_device *obd;
        struct inode *root = NULL;
         struct ll_sb_info *sbi = ll_s2sbi(sb);
         struct obd_device *obd;
-        struct obd_capa *oc = NULL;
         struct obd_statfs *osfs = NULL;
         struct ptlrpc_request *request = NULL;
         struct obd_connect_data *data = NULL;
         struct obd_statfs *osfs = NULL;
         struct ptlrpc_request *request = NULL;
         struct obd_connect_data *data = NULL;
@@ -368,16 +367,6 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
                 }
         }
 
                 }
         }
 
-        if (data->ocd_connect_flags & OBD_CONNECT_MDS_CAPA) {
-                LCONSOLE_INFO("client enabled MDS capability!\n");
-                sbi->ll_flags |= LL_SBI_MDS_CAPA;
-        }
-
-        if (data->ocd_connect_flags & OBD_CONNECT_OSS_CAPA) {
-                LCONSOLE_INFO("client enabled OSS capability!\n");
-                sbi->ll_flags |= LL_SBI_OSS_CAPA;
-        }
-
         if (data->ocd_connect_flags & OBD_CONNECT_64BITHASH)
                 sbi->ll_flags |= LL_SBI_64BIT_HASH;
 
         if (data->ocd_connect_flags & OBD_CONNECT_64BITHASH)
                 sbi->ll_flags |= LL_SBI_64BIT_HASH;
 
@@ -477,7 +466,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
        mutex_unlock(&sbi->ll_lco.lco_lock);
 
        fid_zero(&sbi->ll_root_fid);
        mutex_unlock(&sbi->ll_lco.lco_lock);
 
        fid_zero(&sbi->ll_root_fid);
-       err = md_getstatus(sbi->ll_md_exp, &sbi->ll_root_fid, &oc);
+       err = md_getstatus(sbi->ll_md_exp, &sbi->ll_root_fid);
        if (err) {
                CERROR("cannot mds_connect: rc = %d\n", err);
                GOTO(out_lock_cn_cb, err);
        if (err) {
                CERROR("cannot mds_connect: rc = %d\n", err);
                GOTO(out_lock_cn_cb, err);
@@ -497,8 +486,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
 
        /* make root inode
         * XXX: move this to after cbd setup? */
 
        /* make root inode
         * XXX: move this to after cbd setup? */
-       valid = OBD_MD_FLGETATTR | OBD_MD_FLBLOCKS | OBD_MD_FLMDSCAPA |
-               OBD_MD_FLMODEASIZE;
+       valid = OBD_MD_FLGETATTR | OBD_MD_FLBLOCKS | OBD_MD_FLMODEASIZE;
        if (sbi->ll_flags & LL_SBI_RMT_CLIENT)
                valid |= OBD_MD_FLRMTPERM;
        else if (sbi->ll_flags & LL_SBI_ACL)
        if (sbi->ll_flags & LL_SBI_RMT_CLIENT)
                valid |= OBD_MD_FLRMTPERM;
        else if (sbi->ll_flags & LL_SBI_ACL)
@@ -510,12 +498,10 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
 
        op_data->op_fid1 = sbi->ll_root_fid;
        op_data->op_mode = 0;
 
        op_data->op_fid1 = sbi->ll_root_fid;
        op_data->op_mode = 0;
-       op_data->op_capa1 = oc;
        op_data->op_valid = valid;
 
        err = md_getattr(sbi->ll_md_exp, op_data, &request);
        op_data->op_valid = valid;
 
        err = md_getattr(sbi->ll_md_exp, op_data, &request);
-       if (oc)
-               capa_put(oc);
+
        OBD_FREE_PTR(op_data);
        if (err) {
                CERROR("%s: md_getattr failed for root: rc = %d\n",
        OBD_FREE_PTR(op_data);
        if (err) {
                CERROR("%s: md_getattr failed for root: rc = %d\n",
@@ -935,9 +921,7 @@ void ll_lli_init(struct ll_inode_info *lli)
        mutex_init(&lli->lli_rmtperm_mutex);
        /* Do not set lli_fid, it has been initialized already. */
        fid_zero(&lli->lli_pfid);
        mutex_init(&lli->lli_rmtperm_mutex);
        /* Do not set lli_fid, it has been initialized already. */
        fid_zero(&lli->lli_pfid);
-       INIT_LIST_HEAD(&lli->lli_oss_capas);
        atomic_set(&lli->lli_open_count, 0);
        atomic_set(&lli->lli_open_count, 0);
-       lli->lli_mds_capa = NULL;
        lli->lli_rmtperm_time = 0;
        lli->lli_mds_read_och = NULL;
         lli->lli_mds_write_och = NULL;
        lli->lli_rmtperm_time = 0;
        lli->lli_mds_read_och = NULL;
         lli->lli_mds_write_och = NULL;
@@ -1100,8 +1084,6 @@ void ll_put_super(struct super_block *sb)
 
         CDEBUG(D_VFSTRACE, "VFS Op: sb %p - %s\n", sb, profilenm);
 
 
         CDEBUG(D_VFSTRACE, "VFS Op: sb %p - %s\n", sb, profilenm);
 
-        ll_print_capa_stat(sbi);
-
         cfg.cfg_instance = sb;
         lustre_end_log(sb, profilenm, &cfg);
 
         cfg.cfg_instance = sb;
         lustre_end_log(sb, profilenm, &cfg);
 
@@ -1448,7 +1430,6 @@ void ll_clear_inode(struct inode *inode)
 #endif
        lli->lli_inode_magic = LLI_INODE_DEAD;
 
 #endif
        lli->lli_inode_magic = LLI_INODE_DEAD;
 
-       ll_clear_inode_capas(inode);
        if (S_ISDIR(inode->i_mode))
                ll_dir_clear_lsm_md(inode);
        else if (S_ISREG(inode->i_mode) && !is_bad_inode(inode))
        if (S_ISDIR(inode->i_mode))
                ll_dir_clear_lsm_md(inode);
        else if (S_ISREG(inode->i_mode) && !is_bad_inode(inode))
@@ -1946,16 +1927,6 @@ int ll_update_inode(struct inode *inode, struct lustre_md *md)
                        inode->i_blocks = body->mbo_blocks;
        }
 
                        inode->i_blocks = body->mbo_blocks;
        }
 
-       if (body->mbo_valid & OBD_MD_FLMDSCAPA) {
-               LASSERT(md->mds_capa);
-               ll_add_capa(inode, md->mds_capa);
-       }
-
-       if (body->mbo_valid & OBD_MD_FLOSSCAPA) {
-               LASSERT(md->oss_capa);
-               ll_add_capa(inode, md->oss_capa);
-       }
-
        if (body->mbo_valid & OBD_MD_TSTATE) {
                if (body->mbo_t_state & MS_RESTORE)
                        lli->lli_flags |= LLIF_FILE_RESTORING;
        if (body->mbo_valid & OBD_MD_TSTATE) {
                if (body->mbo_t_state & MS_RESTORE)
                        lli->lli_flags |= LLIF_FILE_RESTORING;
@@ -2446,7 +2417,6 @@ struct md_op_data *ll_prep_md_op_data(struct md_op_data *op_data,
 
        ll_i2gids(op_data->op_suppgids, i1, i2);
        op_data->op_fid1 = *ll_inode2fid(i1);
 
        ll_i2gids(op_data->op_suppgids, i1, i2);
        op_data->op_fid1 = *ll_inode2fid(i1);
-       op_data->op_capa1 = ll_mdscapa_get(i1);
        op_data->op_default_stripe_offset = -1;
        if (S_ISDIR(i1->i_mode)) {
                op_data->op_mea1 = ll_i2info(i1)->lli_lsm_md;
        op_data->op_default_stripe_offset = -1;
        if (S_ISDIR(i1->i_mode)) {
                op_data->op_mea1 = ll_i2info(i1)->lli_lsm_md;
@@ -2457,12 +2427,10 @@ struct md_op_data *ll_prep_md_op_data(struct md_op_data *op_data,
 
        if (i2) {
                op_data->op_fid2 = *ll_inode2fid(i2);
 
        if (i2) {
                op_data->op_fid2 = *ll_inode2fid(i2);
-               op_data->op_capa2 = ll_mdscapa_get(i2);
                if (S_ISDIR(i2->i_mode))
                        op_data->op_mea2 = ll_i2info(i2)->lli_lsm_md;
        } else {
                fid_zero(&op_data->op_fid2);
                if (S_ISDIR(i2->i_mode))
                        op_data->op_mea2 = ll_i2info(i2)->lli_lsm_md;
        } else {
                fid_zero(&op_data->op_fid2);
-               op_data->op_capa2 = NULL;
        }
 
        if (ll_i2sbi(i1)->ll_flags & LL_SBI_64BIT_HASH)
        }
 
        if (ll_i2sbi(i1)->ll_flags & LL_SBI_64BIT_HASH)
@@ -2497,8 +2465,6 @@ struct md_op_data *ll_prep_md_op_data(struct md_op_data *op_data,
 
 void ll_finish_md_op_data(struct md_op_data *op_data)
 {
 
 void ll_finish_md_op_data(struct md_op_data *op_data)
 {
-        capa_put(op_data->op_capa1);
-        capa_put(op_data->op_capa2);
         OBD_FREE_PTR(op_data);
 }
 
         OBD_FREE_PTR(op_data);
 }
 
index 2789412..99a30e4 100644 (file)
@@ -257,7 +257,6 @@ int lustre_check_remote_perm(struct inode *inode, int mask)
         struct ll_sb_info *sbi = ll_i2sbi(inode);
         struct ptlrpc_request *req = NULL;
         struct mdt_remote_perm *perm;
         struct ll_sb_info *sbi = ll_i2sbi(inode);
         struct ptlrpc_request *req = NULL;
         struct mdt_remote_perm *perm;
-        struct obd_capa *oc;
         cfs_time_t save;
         int i = 0, rc;
         ENTRY;
         cfs_time_t save;
         int i = 0, rc;
         ENTRY;
@@ -285,10 +284,8 @@ int lustre_check_remote_perm(struct inode *inode, int mask)
                         LBUG();
                 }
 
                         LBUG();
                 }
 
-                oc = ll_mdscapa_get(inode);
-                rc = md_get_remote_perm(sbi->ll_md_exp, ll_inode2fid(inode), oc,
-                                        ll_i2suppgid(inode), &req);
-                capa_put(oc);
+               rc = md_get_remote_perm(sbi->ll_md_exp, ll_inode2fid(inode),
+                                       ll_i2suppgid(inode), &req);
                 if (rc) {
                        mutex_unlock(&lli->lli_rmtperm_mutex);
                         break;
                 if (rc) {
                        mutex_unlock(&lli->lli_rmtperm_mutex);
                         break;
index 6adb7e8..5e136b1 100644 (file)
@@ -724,27 +724,16 @@ static void sa_fini_data(struct md_enqueue_info *minfo,
 {
         LASSERT(minfo && einfo);
         iput(minfo->mi_dir);
 {
         LASSERT(minfo && einfo);
         iput(minfo->mi_dir);
-        capa_put(minfo->mi_data.op_capa1);
-        capa_put(minfo->mi_data.op_capa2);
         OBD_FREE_PTR(minfo);
         OBD_FREE_PTR(einfo);
 }
 
 /*
  * prepare arguments for async stat RPC.
         OBD_FREE_PTR(minfo);
         OBD_FREE_PTR(einfo);
 }
 
 /*
  * prepare arguments for async stat RPC.
- *
- * There is race condition between "capa_put" and "ll_statahead_interpret" for
- * accessing "op_data.op_capa[1,2]" as following:
- * "capa_put" releases "op_data.op_capa[1,2]"'s reference count after calling
- * "md_intent_getattr_async". But "ll_statahead_interpret" maybe run first, and
- * fill "op_data.op_capa[1,2]" as POISON, then cause "capa_put" access invalid
- * "ocapa". So here reserve "op_data.op_capa[1,2]" in "pcapa" before calling
- * "md_intent_getattr_async".
  */
 static int sa_prep_data(struct inode *dir, struct inode *child,
                        struct sa_entry *entry, struct md_enqueue_info **pmi,
  */
 static int sa_prep_data(struct inode *dir, struct inode *child,
                        struct sa_entry *entry, struct md_enqueue_info **pmi,
-                       struct ldlm_enqueue_info **pei,
-                       struct obd_capa **pcapa)
+                       struct ldlm_enqueue_info **pei)
 {
         struct qstr              *qstr = &entry->se_qstr;
         struct md_enqueue_info   *minfo;
 {
         struct qstr              *qstr = &entry->se_qstr;
         struct md_enqueue_info   *minfo;
@@ -783,8 +772,6 @@ static int sa_prep_data(struct inode *dir, struct inode *child,
 
         *pmi = minfo;
         *pei = einfo;
 
         *pmi = minfo;
         *pei = einfo;
-        pcapa[0] = op_data->op_capa1;
-        pcapa[1] = op_data->op_capa2;
 
         return 0;
 }
 
         return 0;
 }
@@ -794,21 +781,16 @@ static int sa_lookup(struct inode *dir, struct sa_entry *entry)
 {
        struct md_enqueue_info   *minfo;
        struct ldlm_enqueue_info *einfo;
 {
        struct md_enqueue_info   *minfo;
        struct ldlm_enqueue_info *einfo;
-       struct obd_capa          *capas[2];
        int                       rc;
        ENTRY;
 
        int                       rc;
        ENTRY;
 
-       rc = sa_prep_data(dir, NULL, entry, &minfo, &einfo, capas);
+       rc = sa_prep_data(dir, NULL, entry, &minfo, &einfo);
        if (rc)
                RETURN(rc);
 
        rc = md_intent_getattr_async(ll_i2mdexp(dir), minfo, einfo);
        if (rc)
                RETURN(rc);
 
        rc = md_intent_getattr_async(ll_i2mdexp(dir), minfo, einfo);
-       if (!rc) {
-               capa_put(capas[0]);
-               capa_put(capas[1]);
-       } else {
+       if (rc < 0)
                sa_fini_data(minfo, einfo);
                sa_fini_data(minfo, einfo);
-       }
 
        RETURN(rc);
 }
 
        RETURN(rc);
 }
@@ -828,7 +810,6 @@ static int sa_revalidate(struct inode *dir, struct sa_entry *entry,
                                    .d.lustre.it_lock_handle = 0 };
        struct md_enqueue_info *minfo;
        struct ldlm_enqueue_info *einfo;
                                    .d.lustre.it_lock_handle = 0 };
        struct md_enqueue_info *minfo;
        struct ldlm_enqueue_info *einfo;
-       struct obd_capa *capas[2];
        int rc;
        ENTRY;
 
        int rc;
        ENTRY;
 
@@ -847,7 +828,7 @@ static int sa_revalidate(struct inode *dir, struct sa_entry *entry,
                RETURN(1);
        }
 
                RETURN(1);
        }
 
-       rc = sa_prep_data(dir, inode, entry, &minfo, &einfo, capas);
+       rc = sa_prep_data(dir, inode, entry, &minfo, &einfo);
        if (rc) {
                entry->se_inode = NULL;
                iput(inode);
        if (rc) {
                entry->se_inode = NULL;
                iput(inode);
@@ -855,10 +836,7 @@ static int sa_revalidate(struct inode *dir, struct sa_entry *entry,
        }
 
        rc = md_intent_getattr_async(ll_i2mdexp(dir), minfo, einfo);
        }
 
        rc = md_intent_getattr_async(ll_i2mdexp(dir), minfo, einfo);
-       if (!rc) {
-               capa_put(capas[0]);
-               capa_put(capas[1]);
-       } else {
+       if (rc < 0) {
                entry->se_inode = NULL;
                iput(inode);
                sa_fini_data(minfo, einfo);
                entry->se_inode = NULL;
                iput(inode);
                sa_fini_data(minfo, einfo);
index e091ffb..39f6f0f 100644 (file)
@@ -167,15 +167,9 @@ static int __init init_lustre_lite(void)
        do_gettimeofday(&tv);
        cfs_srand(tv.tv_sec ^ seed[0], tv.tv_usec ^ seed[1]);
 
        do_gettimeofday(&tv);
        cfs_srand(tv.tv_sec ^ seed[0], tv.tv_usec ^ seed[1]);
 
-       init_timer(&ll_capa_timer);
-       ll_capa_timer.function = ll_capa_timer_callback;
-       rc = ll_capa_thread_start();
-       if (rc != 0)
-               GOTO(out_proc, rc);
-
        rc = vvp_global_init();
        if (rc != 0)
        rc = vvp_global_init();
        if (rc != 0)
-               GOTO(out_capa, rc);
+               GOTO(out_proc, rc);
 
        cl_inode_fini_env = cl_env_alloc(&cl_inode_fini_refcheck,
                                         LCT_REMEMBER | LCT_NOREF);
 
        cl_inode_fini_env = cl_env_alloc(&cl_inode_fini_refcheck,
                                         LCT_REMEMBER | LCT_NOREF);
@@ -198,9 +192,6 @@ out_inode_fini_env:
        cl_env_put(cl_inode_fini_env, &cl_inode_fini_refcheck);
 out_vvp:
        vvp_global_fini();
        cl_env_put(cl_inode_fini_env, &cl_inode_fini_refcheck);
 out_vvp:
        vvp_global_fini();
-out_capa:
-       del_timer(&ll_capa_timer);
-       ll_capa_thread_stop();
 out_proc:
        lprocfs_remove(&proc_lustre_fs_root);
 out_cache:
 out_proc:
        lprocfs_remove(&proc_lustre_fs_root);
 out_cache:
@@ -230,11 +221,6 @@ static void __exit exit_lustre_lite(void)
        ll_xattr_fini();
        cl_env_put(cl_inode_fini_env, &cl_inode_fini_refcheck);
        vvp_global_fini();
        ll_xattr_fini();
        cl_env_put(cl_inode_fini_env, &cl_inode_fini_refcheck);
        vvp_global_fini();
-       del_timer(&ll_capa_timer);
-       ll_capa_thread_stop();
-       LASSERTF(capa_count[CAPA_SITE_CLIENT] == 0,
-                "client remaining capa count %d\n",
-                capa_count[CAPA_SITE_CLIENT]);
 
        kmem_cache_destroy(ll_inode_cachep);
        kmem_cache_destroy(ll_rmtperm_hash_cachep);
 
        kmem_cache_destroy(ll_inode_cachep);
        kmem_cache_destroy(ll_rmtperm_hash_cachep);
index bb5ce79..d92dd1f 100644 (file)
@@ -47,7 +47,6 @@
 enum obd_notify_event;
 struct inode;
 struct lustre_md;
 enum obd_notify_event;
 struct inode;
 struct lustre_md;
-struct obd_capa;
 struct obd_device;
 struct obd_export;
 struct page;
 struct obd_device;
 struct obd_export;
 struct page;
index 3a079d2..35789c6 100644 (file)
@@ -110,7 +110,6 @@ int ll_setxattr_common(struct inode *inode, const char *name,
        struct ll_sb_info *sbi = ll_i2sbi(inode);
        struct ptlrpc_request *req = NULL;
         int xattr_type, rc;
        struct ll_sb_info *sbi = ll_i2sbi(inode);
        struct ptlrpc_request *req = NULL;
         int xattr_type, rc;
-        struct obd_capa *oc;
         posix_acl_xattr_header *new_value = NULL;
         struct rmtacl_ctl_entry *rce = NULL;
         ext_acl_xattr_header *acl = NULL;
         posix_acl_xattr_header *new_value = NULL;
         struct rmtacl_ctl_entry *rce = NULL;
         ext_acl_xattr_header *acl = NULL;
@@ -191,11 +190,9 @@ int ll_setxattr_common(struct inode *inode, const char *name,
                 valid |= rce_ops2valid(rce->rce_ops);
         }
 #endif
                 valid |= rce_ops2valid(rce->rce_ops);
         }
 #endif
-       oc = ll_mdscapa_get(inode);
-       rc = md_setxattr(sbi->ll_md_exp, ll_inode2fid(inode), oc,
-                       valid, name, pv, size, 0, flags,
-                       ll_i2suppgid(inode), &req);
-       capa_put(oc);
+       rc = md_setxattr(sbi->ll_md_exp, ll_inode2fid(inode), valid, name, pv,
+                        size, 0, flags, ll_i2suppgid(inode), &req);
+
 #ifdef CONFIG_FS_POSIX_ACL
         if (new_value != NULL)
                 lustre_posix_acl_xattr_free(new_value, size);
 #ifdef CONFIG_FS_POSIX_ACL
         if (new_value != NULL)
                 lustre_posix_acl_xattr_free(new_value, size);
@@ -295,7 +292,6 @@ int ll_getxattr_common(struct inode *inode, const char *name,
         struct mdt_body *body;
         int xattr_type, rc;
         void *xdata;
         struct mdt_body *body;
         int xattr_type, rc;
         void *xdata;
-        struct obd_capa *oc;
         struct rmtacl_ctl_entry *rce = NULL;
        struct ll_inode_info *lli = ll_i2info(inode);
         ENTRY;
         struct rmtacl_ctl_entry *rce = NULL;
        struct ll_inode_info *lli = ll_i2info(inode);
         ENTRY;
@@ -386,11 +382,9 @@ do_getxattr:
                }
        } else {
 getxattr_nocache:
                }
        } else {
 getxattr_nocache:
-               oc = ll_mdscapa_get(inode);
-               rc = md_getxattr(sbi->ll_md_exp, ll_inode2fid(inode), oc,
+               rc = md_getxattr(sbi->ll_md_exp, ll_inode2fid(inode),
                                valid | (rce ? rce_ops2valid(rce->rce_ops) : 0),
                                name, NULL, 0, size, 0, &req);
                                valid | (rce ? rce_ops2valid(rce->rce_ops) : 0),
                                name, NULL, 0, size, 0, &req);
-               capa_put(oc);
 
                if (rc < 0)
                        GOTO(out_xattr, rc);
 
                if (rc < 0)
                        GOTO(out_xattr, rc);
index a2c9e1f..861e336 100644 (file)
@@ -1499,9 +1499,7 @@ out_free_temp:
         return rc;
 }
 
         return rc;
 }
 
-static int lmv_getstatus(struct obd_export *exp,
-                         struct lu_fid *fid,
-                         struct obd_capa **pc)
+static int lmv_getstatus(struct obd_export *exp, struct lu_fid *fid)
 {
         struct obd_device    *obd = exp->exp_obd;
         struct lmv_obd       *lmv = &obd->u.lmv;
 {
         struct obd_device    *obd = exp->exp_obd;
         struct lmv_obd       *lmv = &obd->u.lmv;
@@ -1512,12 +1510,12 @@ static int lmv_getstatus(struct obd_export *exp,
         if (rc)
                 RETURN(rc);
 
         if (rc)
                 RETURN(rc);
 
-       rc = md_getstatus(lmv->tgts[0]->ltd_exp, fid, pc);
+       rc = md_getstatus(lmv->tgts[0]->ltd_exp, fid);
        RETURN(rc);
 }
 
 static int lmv_getxattr(struct obd_export *exp, const struct lu_fid *fid,
        RETURN(rc);
 }
 
 static int lmv_getxattr(struct obd_export *exp, const struct lu_fid *fid,
-                       struct obd_capa *oc, u64 valid, const char *name,
+                       u64 valid, const char *name,
                        const char *input, int input_size, int output_size,
                        int flags, struct ptlrpc_request **request)
 {
                        const char *input, int input_size, int output_size,
                        int flags, struct ptlrpc_request **request)
 {
@@ -1535,14 +1533,14 @@ static int lmv_getxattr(struct obd_export *exp, const struct lu_fid *fid,
         if (IS_ERR(tgt))
                 RETURN(PTR_ERR(tgt));
 
         if (IS_ERR(tgt))
                 RETURN(PTR_ERR(tgt));
 
-        rc = md_getxattr(tgt->ltd_exp, fid, oc, valid, name, input,
-                         input_size, output_size, flags, request);
+       rc = md_getxattr(tgt->ltd_exp, fid, valid, name, input,
+                        input_size, output_size, flags, request);
 
 
-        RETURN(rc);
+       RETURN(rc);
 }
 
 static int lmv_setxattr(struct obd_export *exp, const struct lu_fid *fid,
 }
 
 static int lmv_setxattr(struct obd_export *exp, const struct lu_fid *fid,
-                       struct obd_capa *oc, u64 valid, const char *name,
+                       u64 valid, const char *name,
                        const char *input, int input_size, int output_size,
                        int flags, __u32 suppgid,
                        struct ptlrpc_request **request)
                        const char *input, int input_size, int output_size,
                        int flags, __u32 suppgid,
                        struct ptlrpc_request **request)
@@ -1561,11 +1559,11 @@ static int lmv_setxattr(struct obd_export *exp, const struct lu_fid *fid,
         if (IS_ERR(tgt))
                 RETURN(PTR_ERR(tgt));
 
         if (IS_ERR(tgt))
                 RETURN(PTR_ERR(tgt));
 
-        rc = md_setxattr(tgt->ltd_exp, fid, oc, valid, name, input,
-                         input_size, output_size, flags, suppgid,
-                         request);
+       rc = md_setxattr(tgt->ltd_exp, fid, valid, name, input,
+                        input_size, output_size, flags, suppgid,
+                        request);
 
 
-        RETURN(rc);
+       RETURN(rc);
 }
 
 static int lmv_getattr(struct obd_export *exp, struct md_op_data *op_data,
 }
 
 static int lmv_getattr(struct obd_export *exp, struct md_op_data *op_data,
@@ -2234,7 +2232,7 @@ static int lmv_setattr(struct obd_export *exp, struct md_op_data *op_data,
 }
 
 static int lmv_fsync(struct obd_export *exp, const struct lu_fid *fid,
 }
 
 static int lmv_fsync(struct obd_export *exp, const struct lu_fid *fid,
-                    struct obd_capa *oc, struct ptlrpc_request **request)
+                    struct ptlrpc_request **request)
 {
        struct obd_device       *obd = exp->exp_obd;
        struct lmv_obd          *lmv = &obd->u.lmv;
 {
        struct obd_device       *obd = exp->exp_obd;
        struct lmv_obd          *lmv = &obd->u.lmv;
@@ -2250,7 +2248,7 @@ static int lmv_fsync(struct obd_export *exp, const struct lu_fid *fid,
        if (IS_ERR(tgt))
                RETURN(PTR_ERR(tgt));
 
        if (IS_ERR(tgt))
                RETURN(PTR_ERR(tgt));
 
-       rc = md_fsync(tgt->ltd_exp, fid, oc, request);
+       rc = md_fsync(tgt->ltd_exp, fid, request);
        RETURN(rc);
 }
 
        RETURN(rc);
 }
 
@@ -3200,10 +3198,8 @@ int lmv_clear_open_replay_data(struct obd_export *exp,
         RETURN(md_clear_open_replay_data(tgt->ltd_exp, och));
 }
 
         RETURN(md_clear_open_replay_data(tgt->ltd_exp, och));
 }
 
-static int lmv_get_remote_perm(struct obd_export *exp,
-                               const struct lu_fid *fid,
-                               struct obd_capa *oc, __u32 suppgid,
-                               struct ptlrpc_request **request)
+static int lmv_get_remote_perm(struct obd_export *exp, const struct lu_fid *fid,
+                              u32 suppgid, struct ptlrpc_request **request)
 {
         struct obd_device       *obd = exp->exp_obd;
         struct lmv_obd          *lmv = &obd->u.lmv;
 {
         struct obd_device       *obd = exp->exp_obd;
         struct lmv_obd          *lmv = &obd->u.lmv;
@@ -3219,40 +3215,8 @@ static int lmv_get_remote_perm(struct obd_export *exp,
         if (IS_ERR(tgt))
                 RETURN(PTR_ERR(tgt));
 
         if (IS_ERR(tgt))
                 RETURN(PTR_ERR(tgt));
 
-        rc = md_get_remote_perm(tgt->ltd_exp, fid, oc, suppgid, request);
-        RETURN(rc);
-}
-
-static int lmv_renew_capa(struct obd_export *exp, struct obd_capa *oc,
-                          renew_capa_cb_t cb)
-{
-        struct obd_device       *obd = exp->exp_obd;
-        struct lmv_obd          *lmv = &obd->u.lmv;
-        struct lmv_tgt_desc     *tgt;
-        int                      rc;
-        ENTRY;
-
-        rc = lmv_check_connect(obd);
-        if (rc)
-                RETURN(rc);
-
-        tgt = lmv_find_target(lmv, &oc->c_capa.lc_fid);
-        if (IS_ERR(tgt))
-                RETURN(PTR_ERR(tgt));
-
-        rc = md_renew_capa(tgt->ltd_exp, oc, cb);
-        RETURN(rc);
-}
-
-int lmv_unpack_capa(struct obd_export *exp, struct ptlrpc_request *req,
-                   const struct req_msg_field *field, struct obd_capa **oc)
-{
-       struct lmv_obd          *lmv = &exp->exp_obd->u.lmv;
-       struct lmv_tgt_desc     *tgt = lmv->tgts[0];
-
-       if (tgt == NULL || tgt->ltd_exp == NULL)
-               RETURN(-EINVAL);
-       return md_unpack_capa(tgt->ltd_exp, req, field, oc);
+       rc = md_get_remote_perm(tgt->ltd_exp, fid, suppgid, request);
+       RETURN(rc);
 }
 
 int lmv_intent_getattr_async(struct obd_export *exp,
 }
 
 int lmv_intent_getattr_async(struct obd_export *exp,
@@ -3456,8 +3420,6 @@ struct md_ops lmv_md_ops = {
        .m_merge_attr           = lmv_merge_attr,
         .m_set_open_replay_data = lmv_set_open_replay_data,
         .m_clear_open_replay_data = lmv_clear_open_replay_data,
        .m_merge_attr           = lmv_merge_attr,
         .m_set_open_replay_data = lmv_set_open_replay_data,
         .m_clear_open_replay_data = lmv_clear_open_replay_data,
-        .m_renew_capa           = lmv_renew_capa,
-        .m_unpack_capa          = lmv_unpack_capa,
         .m_get_remote_perm      = lmv_get_remote_perm,
         .m_intent_getattr_async = lmv_intent_getattr_async,
        .m_revalidate_lock      = lmv_revalidate_lock,
         .m_get_remote_perm      = lmv_get_remote_perm,
         .m_intent_getattr_async = lmv_intent_getattr_async,
        .m_revalidate_lock      = lmv_revalidate_lock,
index 18df100..3b37677 100644 (file)
@@ -44,14 +44,11 @@ extern struct lprocfs_vars lprocfs_mdc_obd_vars[];
 #endif
 
 void mdc_pack_body(struct ptlrpc_request *req, const struct lu_fid *fid,
 #endif
 
 void mdc_pack_body(struct ptlrpc_request *req, const struct lu_fid *fid,
-                  struct obd_capa *oc, __u64 valid, size_t ea_size,
-                  __u32 suppgid, __u32 flags);
-void mdc_pack_capa(struct ptlrpc_request *req,
-                  const struct req_msg_field *field, struct obd_capa *oc);
+                  u64 valid, size_t ea_size, u32 suppgid, u32 flags);
 void mdc_swap_layouts_pack(struct ptlrpc_request *req,
                           struct md_op_data *op_data);
 void mdc_readdir_pack(struct ptlrpc_request *req, __u64 pgoff, size_t size,
 void mdc_swap_layouts_pack(struct ptlrpc_request *req,
                           struct md_op_data *op_data);
 void mdc_readdir_pack(struct ptlrpc_request *req, __u64 pgoff, size_t size,
-                      const struct lu_fid *fid, struct obd_capa *oc);
+                     const struct lu_fid *fid);
 void mdc_getattr_pack(struct ptlrpc_request *req, __u64 valid, __u32 flags,
                      struct md_op_data *data, size_t ea_size);
 void mdc_setattr_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
 void mdc_getattr_pack(struct ptlrpc_request *req, __u64 valid, __u32 flags,
                      struct md_op_data *data, size_t ea_size);
 void mdc_setattr_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
@@ -133,17 +130,6 @@ int mdc_cancel_unused(struct obd_export *exp, const struct lu_fid *fid,
                       ldlm_policy_data_t *policy, ldlm_mode_t mode,
                       ldlm_cancel_flags_t flags, void *opaque);
 
                       ldlm_policy_data_t *policy, ldlm_mode_t mode,
                       ldlm_cancel_flags_t flags, void *opaque);
 
-static inline void mdc_set_capa_size(struct ptlrpc_request *req,
-                                     const struct req_msg_field *field,
-                                     struct obd_capa *oc)
-{
-        if (oc == NULL)
-                req_capsule_set_size(&req->rq_pill, field, RCL_CLIENT, 0);
-        else
-                /* it is already calculated as sizeof struct obd_capa */
-                ;
-}
-
 int mdc_revalidate_lock(struct obd_export *exp, struct lookup_intent *it,
                         struct lu_fid *fid, __u64 *bits);
 
 int mdc_revalidate_lock(struct obd_export *exp, struct lookup_intent *it,
                         struct lu_fid *fid, __u64 *bits);
 
index ca3ed9e..d3a9365 100644 (file)
@@ -59,23 +59,6 @@ static void __mdc_pack_body(struct mdt_body *b, __u32 suppgid)
        b->mbo_capability = cfs_curproc_cap_pack();
 }
 
        b->mbo_capability = cfs_curproc_cap_pack();
 }
 
-void mdc_pack_capa(struct ptlrpc_request *req, const struct req_msg_field *field,
-                   struct obd_capa *oc)
-{
-        struct req_capsule *pill = &req->rq_pill;
-        struct lustre_capa *c;
-
-        if (oc == NULL) {
-                LASSERT(req_capsule_get_size(pill, field, RCL_CLIENT) == 0);
-                return;
-        }
-
-        c = req_capsule_client_get(pill, field);
-        LASSERT(c != NULL);
-        capa_cpy(c, oc);
-        DEBUG_CAPA(D_SEC, c, "pack");
-}
-
 void mdc_swap_layouts_pack(struct ptlrpc_request *req,
                           struct md_op_data *op_data)
 {
 void mdc_swap_layouts_pack(struct ptlrpc_request *req,
                           struct md_op_data *op_data)
 {
@@ -86,14 +69,10 @@ void mdc_swap_layouts_pack(struct ptlrpc_request *req,
        b->mbo_fid1 = op_data->op_fid1;
        b->mbo_fid2 = op_data->op_fid2;
        b->mbo_valid |= OBD_MD_FLID;
        b->mbo_fid1 = op_data->op_fid1;
        b->mbo_fid2 = op_data->op_fid2;
        b->mbo_valid |= OBD_MD_FLID;
-
-       mdc_pack_capa(req, &RMF_CAPA1, op_data->op_capa1);
-       mdc_pack_capa(req, &RMF_CAPA2, op_data->op_capa2);
 }
 
 }
 
-void mdc_pack_body(struct ptlrpc_request *req,
-                  const struct lu_fid *fid, struct obd_capa *oc,
-                  __u64 valid, size_t ea_size, __u32 suppgid, __u32 flags)
+void mdc_pack_body(struct ptlrpc_request *req, const struct lu_fid *fid,
+                  u64 valid, size_t ea_size, u32 suppgid, u32 flags)
 {
        struct mdt_body *b = req_capsule_client_get(&req->rq_pill,
                                                    &RMF_MDT_BODY);
 {
        struct mdt_body *b = req_capsule_client_get(&req->rq_pill,
                                                    &RMF_MDT_BODY);
@@ -105,7 +84,6 @@ void mdc_pack_body(struct ptlrpc_request *req,
        if (fid) {
                b->mbo_fid1 = *fid;
                b->mbo_valid |= OBD_MD_FLID;
        if (fid) {
                b->mbo_fid1 = *fid;
                b->mbo_valid |= OBD_MD_FLID;
-               mdc_pack_capa(req, &RMF_CAPA1, oc);
        }
 }
 
        }
 }
 
@@ -142,7 +120,7 @@ static void mdc_pack_name(struct ptlrpc_request *req,
 }
 
 void mdc_readdir_pack(struct ptlrpc_request *req, __u64 pgoff, size_t size,
 }
 
 void mdc_readdir_pack(struct ptlrpc_request *req, __u64 pgoff, size_t size,
-                     const struct lu_fid *fid, struct obd_capa *oc)
+                     const struct lu_fid *fid)
 {
         struct mdt_body *b = req_capsule_client_get(&req->rq_pill,
                                                     &RMF_MDT_BODY);
 {
         struct mdt_body *b = req_capsule_client_get(&req->rq_pill,
                                                     &RMF_MDT_BODY);
@@ -152,8 +130,6 @@ void mdc_readdir_pack(struct ptlrpc_request *req, __u64 pgoff, size_t size,
        b->mbo_nlink = size;                    /* !! */
        __mdc_pack_body(b, -1);
        b->mbo_mode = LUDA_FID | LUDA_TYPE;
        b->mbo_nlink = size;                    /* !! */
        __mdc_pack_body(b, -1);
        b->mbo_mode = LUDA_FID | LUDA_TYPE;
-
-       mdc_pack_capa(req, &RMF_CAPA1, oc);
 }
 
 /* packing of MDS records */
 }
 
 /* packing of MDS records */
@@ -187,8 +163,6 @@ void mdc_create_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
        rec->cr_bias     = op_data->op_bias;
        rec->cr_umask    = current_umask();
 
        rec->cr_bias     = op_data->op_bias;
        rec->cr_umask    = current_umask();
 
-       mdc_pack_capa(req, &RMF_CAPA1, op_data->op_capa1);
-
        mdc_pack_name(req, &RMF_NAME, op_data->op_name, op_data->op_namelen);
        if (data) {
                tmp = req_capsule_client_get(&req->rq_pill, &RMF_EADATA);
        mdc_pack_name(req, &RMF_NAME, op_data->op_name, op_data->op_namelen);
        if (data) {
                tmp = req_capsule_client_get(&req->rq_pill, &RMF_EADATA);
@@ -256,10 +230,6 @@ void mdc_open_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
                rec->cr_bias       = op_data->op_bias;
                rec->cr_old_handle = op_data->op_handle;
 
                rec->cr_bias       = op_data->op_bias;
                rec->cr_old_handle = op_data->op_handle;
 
-               mdc_pack_capa(req, &RMF_CAPA1, op_data->op_capa1);
-               /* the next buffer is child capa, which is used for replay,
-                * will be packed from the data in reply message. */
-
                if (op_data->op_name) {
                        mdc_pack_name(req, &RMF_NAME, op_data->op_name,
                                      op_data->op_namelen);
                if (op_data->op_name) {
                        mdc_pack_name(req, &RMF_NAME, op_data->op_name,
                                      op_data->op_namelen);
@@ -367,8 +337,6 @@ void mdc_setattr_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
         rec = req_capsule_client_get(&req->rq_pill, &RMF_REC_REINT);
         mdc_setattr_pack_rec(rec, op_data);
 
         rec = req_capsule_client_get(&req->rq_pill, &RMF_REC_REINT);
         mdc_setattr_pack_rec(rec, op_data);
 
-        mdc_pack_capa(req, &RMF_CAPA1, op_data->op_capa1);
-
         if (ealen == 0)
                 return;
 
         if (ealen == 0)
                 return;
 
@@ -404,8 +372,6 @@ void mdc_unlink_pack(struct ptlrpc_request *req, struct md_op_data *op_data)
         rec->ul_time    = op_data->op_mod_time;
         rec->ul_bias    = op_data->op_bias;
 
         rec->ul_time    = op_data->op_mod_time;
         rec->ul_bias    = op_data->op_bias;
 
-        mdc_pack_capa(req, &RMF_CAPA1, op_data->op_capa1);
-
        mdc_pack_name(req, &RMF_NAME, op_data->op_name, op_data->op_namelen);
 }
 
        mdc_pack_name(req, &RMF_NAME, op_data->op_name, op_data->op_namelen);
 }
 
@@ -428,9 +394,6 @@ void mdc_link_pack(struct ptlrpc_request *req, struct md_op_data *op_data)
         rec->lk_time     = op_data->op_mod_time;
         rec->lk_bias     = op_data->op_bias;
 
         rec->lk_time     = op_data->op_mod_time;
         rec->lk_bias     = op_data->op_bias;
 
-        mdc_pack_capa(req, &RMF_CAPA1, op_data->op_capa1);
-        mdc_pack_capa(req, &RMF_CAPA2, op_data->op_capa2);
-
        mdc_pack_name(req, &RMF_NAME, op_data->op_name, op_data->op_namelen);
 }
 
        mdc_pack_name(req, &RMF_NAME, op_data->op_name, op_data->op_namelen);
 }
 
@@ -457,9 +420,6 @@ void mdc_rename_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
         rec->rn_mode     = op_data->op_mode;
         rec->rn_bias     = op_data->op_bias;
 
         rec->rn_mode     = op_data->op_mode;
         rec->rn_bias     = op_data->op_bias;
 
-       mdc_pack_capa(req, &RMF_CAPA1, op_data->op_capa1);
-        mdc_pack_capa(req, &RMF_CAPA2, op_data->op_capa2);
-
        mdc_pack_name(req, &RMF_NAME, old, oldlen);
 
        if (new != NULL)
        mdc_pack_name(req, &RMF_NAME, old, oldlen);
 
        if (new != NULL)
@@ -485,8 +445,6 @@ void mdc_getattr_pack(struct ptlrpc_request *req, __u64 valid, __u32 flags,
        b->mbo_fid2 = op_data->op_fid2;
        b->mbo_valid |= OBD_MD_FLID;
 
        b->mbo_fid2 = op_data->op_fid2;
        b->mbo_valid |= OBD_MD_FLID;
 
-        mdc_pack_capa(req, &RMF_CAPA1, op_data->op_capa1);
-
        if (op_data->op_name != NULL)
                mdc_pack_name(req, &RMF_NAME, op_data->op_name,
                              op_data->op_namelen);
        if (op_data->op_name != NULL)
                mdc_pack_name(req, &RMF_NAME, op_data->op_name,
                              op_data->op_namelen);
@@ -525,7 +483,6 @@ void mdc_close_pack(struct ptlrpc_request *req, struct md_op_data *op_data)
         rec = req_capsule_client_get(&req->rq_pill, &RMF_REC_REINT);
 
         mdc_setattr_pack_rec(rec, op_data);
         rec = req_capsule_client_get(&req->rq_pill, &RMF_REC_REINT);
 
         mdc_setattr_pack_rec(rec, op_data);
-        mdc_pack_capa(req, &RMF_CAPA1, op_data->op_capa1);
         mdc_ioepoch_pack(epoch, op_data);
        mdc_intent_close_pack(req, op_data);
 }
         mdc_ioepoch_pack(epoch, op_data);
        mdc_intent_close_pack(req, op_data);
 }
index 7715281..1866103 100644 (file)
@@ -312,12 +312,6 @@ mdc_intent_open_pack(struct obd_export *exp, struct lookup_intent *it,
                 RETURN(ERR_PTR(-ENOMEM));
         }
 
                 RETURN(ERR_PTR(-ENOMEM));
         }
 
-        /* parent capability */
-        mdc_set_capa_size(req, &RMF_CAPA1, op_data->op_capa1);
-        /* child capability, reserve the size according to parent capa, it will
-         * be filled after we get the reply */
-        mdc_set_capa_size(req, &RMF_CAPA2, op_data->op_capa1);
-
         req_capsule_set_size(&req->rq_pill, &RMF_NAME, RCL_CLIENT,
                              op_data->op_namelen + 1);
        req_capsule_set_size(&req->rq_pill, &RMF_EADATA, RCL_CLIENT,
         req_capsule_set_size(&req->rq_pill, &RMF_NAME, RCL_CLIENT,
                              op_data->op_namelen + 1);
        req_capsule_set_size(&req->rq_pill, &RMF_EADATA, RCL_CLIENT,
@@ -370,8 +364,6 @@ mdc_intent_getxattr_pack(struct obd_export *exp,
        if (req == NULL)
                RETURN(ERR_PTR(-ENOMEM));
 
        if (req == NULL)
                RETURN(ERR_PTR(-ENOMEM));
 
-       mdc_set_capa_size(req, &RMF_CAPA1, op_data->op_capa1);
-
        rc = ldlm_prep_enqueue_req(exp, req, &cancels, count);
        if (rc) {
                ptlrpc_request_free(req);
        rc = ldlm_prep_enqueue_req(exp, req, &cancels, count);
        if (rc) {
                ptlrpc_request_free(req);
@@ -385,8 +377,8 @@ mdc_intent_getxattr_pack(struct obd_export *exp,
        maxdata = class_exp2cliimp(exp)->imp_connect_data.ocd_max_easize;
 
        /* pack the intended request */
        maxdata = class_exp2cliimp(exp)->imp_connect_data.ocd_max_easize;
 
        /* pack the intended request */
-       mdc_pack_body(req, &op_data->op_fid1, op_data->op_capa1,
-                       op_data->op_valid, maxdata, -1, 0);
+       mdc_pack_body(req, &op_data->op_fid1, op_data->op_valid, maxdata, -1,
+                     0);
 
        req_capsule_set_size(&req->rq_pill, &RMF_EADATA,
                                RCL_SERVER, maxdata);
 
        req_capsule_set_size(&req->rq_pill, &RMF_EADATA,
                                RCL_SERVER, maxdata);
@@ -417,7 +409,6 @@ static struct ptlrpc_request *mdc_intent_unlink_pack(struct obd_export *exp,
         if (req == NULL)
                 RETURN(ERR_PTR(-ENOMEM));
 
         if (req == NULL)
                 RETURN(ERR_PTR(-ENOMEM));
 
-        mdc_set_capa_size(req, &RMF_CAPA1, op_data->op_capa1);
         req_capsule_set_size(&req->rq_pill, &RMF_NAME, RCL_CLIENT,
                              op_data->op_namelen + 1);
 
         req_capsule_set_size(&req->rq_pill, &RMF_NAME, RCL_CLIENT,
                              op_data->op_namelen + 1);
 
@@ -448,7 +439,7 @@ static struct ptlrpc_request *mdc_intent_getattr_pack(struct obd_export *exp,
        struct obd_device       *obddev = class_exp2obd(exp);
        u64                      valid = OBD_MD_FLGETATTR | OBD_MD_FLEASIZE |
                                         OBD_MD_FLMODEASIZE | OBD_MD_FLDIREA |
        struct obd_device       *obddev = class_exp2obd(exp);
        u64                      valid = OBD_MD_FLGETATTR | OBD_MD_FLEASIZE |
                                         OBD_MD_FLMODEASIZE | OBD_MD_FLDIREA |
-                                        OBD_MD_FLMDSCAPA | OBD_MD_MEA |
+                                        OBD_MD_MEA |
                                         (client_is_remote(exp) ?
                                          OBD_MD_FLRMTPERM : OBD_MD_FLACL);
        struct ldlm_intent      *lit;
                                         (client_is_remote(exp) ?
                                          OBD_MD_FLRMTPERM : OBD_MD_FLACL);
        struct ldlm_intent      *lit;
@@ -461,7 +452,6 @@ static struct ptlrpc_request *mdc_intent_getattr_pack(struct obd_export *exp,
         if (req == NULL)
                 RETURN(ERR_PTR(-ENOMEM));
 
         if (req == NULL)
                 RETURN(ERR_PTR(-ENOMEM));
 
-        mdc_set_capa_size(req, &RMF_CAPA1, op_data->op_capa1);
         req_capsule_set_size(&req->rq_pill, &RMF_NAME, RCL_CLIENT,
                              op_data->op_namelen + 1);
 
         req_capsule_set_size(&req->rq_pill, &RMF_NAME, RCL_CLIENT,
                              op_data->op_namelen + 1);
 
@@ -702,27 +692,6 @@ static int mdc_finish_enqueue(struct obd_export *exp,
                         if (perm == NULL)
                                 RETURN(-EPROTO);
                 }
                         if (perm == NULL)
                                 RETURN(-EPROTO);
                 }
-               if (body->mbo_valid & OBD_MD_FLMDSCAPA) {
-                        struct lustre_capa *capa, *p;
-
-                        capa = req_capsule_server_get(pill, &RMF_CAPA1);
-                        if (capa == NULL)
-                                RETURN(-EPROTO);
-
-                        if (it->it_op & IT_OPEN) {
-                                /* client fid capa will be checked in replay */
-                                p = req_capsule_client_get(pill, &RMF_CAPA2);
-                                LASSERT(p);
-                                *p = *capa;
-                        }
-                }
-               if (body->mbo_valid & OBD_MD_FLOSSCAPA) {
-                        struct lustre_capa *capa;
-
-                        capa = req_capsule_server_get(pill, &RMF_CAPA2);
-                        if (capa == NULL)
-                                RETURN(-EPROTO);
-                }
         } else if (it->it_op & IT_LAYOUT) {
                /* maybe the lock was granted right away and layout
                 * is packed into RMF_DLM_LVB of req */
         } else if (it->it_op & IT_LAYOUT) {
                /* maybe the lock was granted right away and layout
                 * is packed into RMF_DLM_LVB of req */
index 55ec685..3e5731a 100644 (file)
@@ -127,7 +127,7 @@ int mdc_setattr(struct obd_export *exp, struct md_op_data *op_data,
                 ldlm_lock_list_put(&cancels, l_bl_ast, count);
                 RETURN(-ENOMEM);
         }
                 ldlm_lock_list_put(&cancels, l_bl_ast, count);
                 RETURN(-ENOMEM);
         }
-        mdc_set_capa_size(req, &RMF_CAPA1, op_data->op_capa1);
+
        req_capsule_set_size(&req->rq_pill, &RMF_MDT_EPOCH, RCL_CLIENT, 0);
        req_capsule_set_size(&req->rq_pill, &RMF_EADATA, RCL_CLIENT, ealen);
        req_capsule_set_size(&req->rq_pill, &RMF_LOGCOOKIES, RCL_CLIENT, 0);
        req_capsule_set_size(&req->rq_pill, &RMF_MDT_EPOCH, RCL_CLIENT, 0);
        req_capsule_set_size(&req->rq_pill, &RMF_EADATA, RCL_CLIENT, ealen);
        req_capsule_set_size(&req->rq_pill, &RMF_LOGCOOKIES, RCL_CLIENT, 0);
@@ -197,7 +197,7 @@ rebuild:
                 ldlm_lock_list_put(&cancels, l_bl_ast, count);
                 RETURN(-ENOMEM);
         }
                 ldlm_lock_list_put(&cancels, l_bl_ast, count);
                 RETURN(-ENOMEM);
         }
-        mdc_set_capa_size(req, &RMF_CAPA1, op_data->op_capa1);
+
         req_capsule_set_size(&req->rq_pill, &RMF_NAME, RCL_CLIENT,
                              op_data->op_namelen + 1);
         req_capsule_set_size(&req->rq_pill, &RMF_EADATA, RCL_CLIENT,
         req_capsule_set_size(&req->rq_pill, &RMF_NAME, RCL_CLIENT,
                              op_data->op_namelen + 1);
         req_capsule_set_size(&req->rq_pill, &RMF_EADATA, RCL_CLIENT,
@@ -251,18 +251,6 @@ rebuild:
                         CDEBUG(D_HA, "resend cross eviction\n");
                         RETURN(-EIO);
                 }
                         CDEBUG(D_HA, "resend cross eviction\n");
                         RETURN(-EIO);
                 }
-        } else if (rc == 0) {
-                struct mdt_body *body;
-                struct lustre_capa *capa;
-
-                body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
-                LASSERT(body);
-               if (body->mbo_valid & OBD_MD_FLMDSCAPA) {
-                        capa = req_capsule_server_get(&req->rq_pill,
-                                                      &RMF_CAPA1);
-                        if (capa == NULL)
-                                rc = -EPROTO;
-                }
         }
 
         *request = req;
         }
 
         *request = req;
@@ -296,7 +284,7 @@ int mdc_unlink(struct obd_export *exp, struct md_op_data *op_data,
                 ldlm_lock_list_put(&cancels, l_bl_ast, count);
                 RETURN(-ENOMEM);
         }
                 ldlm_lock_list_put(&cancels, l_bl_ast, count);
                 RETURN(-ENOMEM);
         }
-        mdc_set_capa_size(req, &RMF_CAPA1, op_data->op_capa1);
+
         req_capsule_set_size(&req->rq_pill, &RMF_NAME, RCL_CLIENT,
                              op_data->op_namelen + 1);
 
         req_capsule_set_size(&req->rq_pill, &RMF_NAME, RCL_CLIENT,
                              op_data->op_namelen + 1);
 
@@ -345,8 +333,7 @@ int mdc_link(struct obd_export *exp, struct md_op_data *op_data,
                 ldlm_lock_list_put(&cancels, l_bl_ast, count);
                 RETURN(-ENOMEM);
         }
                 ldlm_lock_list_put(&cancels, l_bl_ast, count);
                 RETURN(-ENOMEM);
         }
-        mdc_set_capa_size(req, &RMF_CAPA1, op_data->op_capa1);
-        mdc_set_capa_size(req, &RMF_CAPA2, op_data->op_capa2);
+
         req_capsule_set_size(&req->rq_pill, &RMF_NAME, RCL_CLIENT,
                              op_data->op_namelen + 1);
 
         req_capsule_set_size(&req->rq_pill, &RMF_NAME, RCL_CLIENT,
                              op_data->op_namelen + 1);
 
@@ -405,8 +392,6 @@ int mdc_rename(struct obd_export *exp, struct md_op_data *op_data,
                 RETURN(-ENOMEM);
         }
 
                 RETURN(-ENOMEM);
         }
 
-        mdc_set_capa_size(req, &RMF_CAPA1, op_data->op_capa1);
-        mdc_set_capa_size(req, &RMF_CAPA2, op_data->op_capa2);
         req_capsule_set_size(&req->rq_pill, &RMF_NAME, RCL_CLIENT, oldlen + 1);
         req_capsule_set_size(&req->rq_pill, &RMF_SYMTGT, RCL_CLIENT, newlen+1);
 
         req_capsule_set_size(&req->rq_pill, &RMF_NAME, RCL_CLIENT, oldlen + 1);
         req_capsule_set_size(&req->rq_pill, &RMF_SYMTGT, RCL_CLIENT, newlen+1);
 
index 59fd844..f378eb8 100644 (file)
 
 #define REQUEST_MINOR 244
 
 
 #define REQUEST_MINOR 244
 
-struct mdc_renew_capa_args {
-        struct obd_capa        *ra_oc;
-        renew_capa_cb_t         ra_cb;
-};
-
 static int mdc_cleanup(struct obd_device *obd);
 
 static int mdc_cleanup(struct obd_device *obd);
 
-static int mdc_unpack_capa(struct obd_export *exp, struct ptlrpc_request *req,
-                          const struct req_msg_field *field,
-                          struct obd_capa **oc)
-{
-        struct lustre_capa *capa;
-        struct obd_capa *c;
-        ENTRY;
-
-        /* swabbed already in mdc_enqueue */
-        capa = req_capsule_server_get(&req->rq_pill, field);
-        if (capa == NULL)
-                RETURN(-EPROTO);
-
-        c = alloc_capa(CAPA_SITE_CLIENT);
-        if (IS_ERR(c)) {
-                CDEBUG(D_INFO, "alloc capa failed!\n");
-                RETURN(PTR_ERR(c));
-        } else {
-                c->c_capa = *capa;
-                *oc = c;
-                RETURN(0);
-        }
-}
-
 static inline int mdc_queue_wait(struct ptlrpc_request *req)
 {
        struct client_obd *cli = &req->rq_import->imp_obd->u.cli;
 static inline int mdc_queue_wait(struct ptlrpc_request *req)
 {
        struct client_obd *cli = &req->rq_import->imp_obd->u.cli;
@@ -111,56 +82,41 @@ static inline int mdc_queue_wait(struct ptlrpc_request *req)
        return rc;
 }
 
        return rc;
 }
 
-/* Helper that implements most of mdc_getstatus and signal_completed_replay. */
-/* XXX this should become mdc_get_info("key"), sending MDS_GET_INFO RPC */
-static int send_getstatus(struct obd_import *imp, struct lu_fid *rootfid,
-                          struct obd_capa **pc, int level, int msg_flags)
+static int mdc_getstatus(struct obd_export *exp, struct lu_fid *rootfid)
 {
 {
-        struct ptlrpc_request *req;
-        struct mdt_body       *body;
-        int                    rc;
-        ENTRY;
+       struct ptlrpc_request   *req;
+       struct mdt_body         *body;
+       int                      rc;
 
 
-        req = ptlrpc_request_alloc_pack(imp, &RQF_MDS_GETSTATUS,
-                                        LUSTRE_MDS_VERSION, MDS_GETSTATUS);
-        if (req == NULL)
-                RETURN(-ENOMEM);
+       ENTRY;
 
 
-        mdc_pack_body(req, NULL, NULL, 0, 0, -1, 0);
-        lustre_msg_add_flags(req->rq_reqmsg, msg_flags);
-        req->rq_send_state = level;
+       req = ptlrpc_request_alloc_pack(class_exp2cliimp(exp),
+                                       &RQF_MDS_GETSTATUS,
+                                       LUSTRE_MDS_VERSION, MDS_GETSTATUS);
+       if (req == NULL)
+               RETURN(-ENOMEM);
 
 
-        ptlrpc_request_set_replen(req);
+       mdc_pack_body(req, NULL, 0, 0, -1, 0);
+       req->rq_send_state = LUSTRE_IMP_FULL;
 
 
-        rc = ptlrpc_queue_wait(req);
-        if (rc)
-                GOTO(out, rc);
+       ptlrpc_request_set_replen(req);
 
 
-        body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
-        if (body == NULL)
-                GOTO(out, rc = -EPROTO);
+       rc = ptlrpc_queue_wait(req);
+       if (rc)
+               GOTO(out, rc);
 
 
-       if (body->mbo_valid & OBD_MD_FLMDSCAPA) {
-               rc = mdc_unpack_capa(NULL, req, &RMF_CAPA1, pc);
-               if (rc)
-                       GOTO(out, rc);
-       }
+       body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
+       if (body == NULL)
+               GOTO(out, rc = -EPROTO);
 
        *rootfid = body->mbo_fid1;
        CDEBUG(D_NET, "root fid="DFID", last_committed="LPU64"\n",
               PFID(rootfid), lustre_msg_get_last_committed(req->rq_repmsg));
 
        *rootfid = body->mbo_fid1;
        CDEBUG(D_NET, "root fid="DFID", last_committed="LPU64"\n",
               PFID(rootfid), lustre_msg_get_last_committed(req->rq_repmsg));
-        EXIT;
+       EXIT;
 out:
 out:
-        ptlrpc_req_finished(req);
-        return rc;
-}
+       ptlrpc_req_finished(req);
 
 
-/* This should be mdc_get_info("rootfid") */
-static int mdc_getstatus(struct obd_export *exp, struct lu_fid *rootfid,
-                        struct obd_capa **pc)
-{
-        return send_getstatus(class_exp2cliimp(exp), rootfid, pc,
-                              LUSTRE_IMP_FULL, 0);
+       return rc;
 }
 
 /*
 }
 
 /*
@@ -212,13 +168,6 @@ static int mdc_getattr_common(struct obd_export *exp,
                         RETURN(-EPROTO);
         }
 
                         RETURN(-EPROTO);
         }
 
-       if (body->mbo_valid & OBD_MD_FLMDSCAPA) {
-                struct lustre_capa *capa;
-                capa = req_capsule_server_get(pill, &RMF_CAPA1);
-                if (capa == NULL)
-                        RETURN(-EPROTO);
-        }
-
         RETURN(0);
 }
 
         RETURN(0);
 }
 
@@ -239,16 +188,14 @@ static int mdc_getattr(struct obd_export *exp, struct md_op_data *op_data,
         if (req == NULL)
                 RETURN(-ENOMEM);
 
         if (req == NULL)
                 RETURN(-ENOMEM);
 
-        mdc_set_capa_size(req, &RMF_CAPA1, op_data->op_capa1);
-
         rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, MDS_GETATTR);
         if (rc) {
                 ptlrpc_request_free(req);
                 RETURN(rc);
         }
 
         rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, MDS_GETATTR);
         if (rc) {
                 ptlrpc_request_free(req);
                 RETURN(rc);
         }
 
-        mdc_pack_body(req, &op_data->op_fid1, op_data->op_capa1,
-                      op_data->op_valid, op_data->op_mode, -1, 0);
+       mdc_pack_body(req, &op_data->op_fid1, op_data->op_valid,
+                     op_data->op_mode, -1, 0);
 
         req_capsule_set_size(&req->rq_pill, &RMF_MDT_MD, RCL_SERVER,
                              op_data->op_mode);
 
         req_capsule_set_size(&req->rq_pill, &RMF_MDT_MD, RCL_SERVER,
                              op_data->op_mode);
@@ -280,7 +227,6 @@ static int mdc_getattr_name(struct obd_export *exp, struct md_op_data *op_data,
         if (req == NULL)
                 RETURN(-ENOMEM);
 
         if (req == NULL)
                 RETURN(-ENOMEM);
 
-        mdc_set_capa_size(req, &RMF_CAPA1, op_data->op_capa1);
         req_capsule_set_size(&req->rq_pill, &RMF_NAME, RCL_CLIENT,
                              op_data->op_namelen + 1);
 
         req_capsule_set_size(&req->rq_pill, &RMF_NAME, RCL_CLIENT,
                              op_data->op_namelen + 1);
 
@@ -290,9 +236,8 @@ static int mdc_getattr_name(struct obd_export *exp, struct md_op_data *op_data,
                 RETURN(rc);
         }
 
                 RETURN(rc);
         }
 
-        mdc_pack_body(req, &op_data->op_fid1, op_data->op_capa1,
-                      op_data->op_valid, op_data->op_mode,
-                      op_data->op_suppgids[0], 0);
+       mdc_pack_body(req, &op_data->op_fid1, op_data->op_valid,
+                     op_data->op_mode, op_data->op_suppgids[0], 0);
 
         if (op_data->op_name) {
                 char *name = req_capsule_client_get(&req->rq_pill, &RMF_NAME);
 
         if (op_data->op_name) {
                 char *name = req_capsule_client_get(&req->rq_pill, &RMF_NAME);
@@ -314,8 +259,7 @@ static int mdc_getattr_name(struct obd_export *exp, struct md_op_data *op_data,
 }
 
 static int mdc_xattr_common(struct obd_export *exp,const struct req_format *fmt,
 }
 
 static int mdc_xattr_common(struct obd_export *exp,const struct req_format *fmt,
-                           const struct lu_fid *fid,
-                           struct obd_capa *oc, int opcode, u64 valid,
+                           const struct lu_fid *fid, int opcode, u64 valid,
                            const char *xattr_name, const char *input,
                            int input_size, int output_size, int flags,
                            __u32 suppgid, struct ptlrpc_request **request)
                            const char *xattr_name, const char *input,
                            int input_size, int output_size, int flags,
                            __u32 suppgid, struct ptlrpc_request **request)
@@ -331,7 +275,6 @@ static int mdc_xattr_common(struct obd_export *exp,const struct req_format *fmt,
         if (req == NULL)
                 RETURN(-ENOMEM);
 
         if (req == NULL)
                 RETURN(-ENOMEM);
 
-        mdc_set_capa_size(req, &RMF_CAPA1, oc);
         if (xattr_name) {
                 xattr_namelen = strlen(xattr_name) + 1;
                 req_capsule_set_size(&req->rq_pill, &RMF_NAME, RCL_CLIENT,
         if (xattr_name) {
                 xattr_namelen = strlen(xattr_name) + 1;
                 req_capsule_set_size(&req->rq_pill, &RMF_NAME, RCL_CLIENT,
@@ -388,11 +331,9 @@ static int mdc_xattr_common(struct obd_export *exp,const struct req_format *fmt,
                 rec->sx_time   = cfs_time_current_sec();
                 rec->sx_size   = output_size;
                 rec->sx_flags  = flags;
                 rec->sx_time   = cfs_time_current_sec();
                 rec->sx_size   = output_size;
                 rec->sx_flags  = flags;
-
-                mdc_pack_capa(req, &RMF_CAPA1, oc);
-        } else {
-                mdc_pack_body(req, fid, oc, valid, output_size, suppgid, flags);
-        }
+       } else {
+               mdc_pack_body(req, fid, valid, output_size, suppgid, flags);
+       }
 
         if (xattr_name) {
                 tmp = req_capsule_client_get(&req->rq_pill, &RMF_NAME);
 
         if (xattr_name) {
                 tmp = req_capsule_client_get(&req->rq_pill, &RMF_NAME);
@@ -425,28 +366,26 @@ static int mdc_xattr_common(struct obd_export *exp,const struct req_format *fmt,
 }
 
 static int mdc_setxattr(struct obd_export *exp, const struct lu_fid *fid,
 }
 
 static int mdc_setxattr(struct obd_export *exp, const struct lu_fid *fid,
-                       struct obd_capa *oc, u64 valid,
-                       const char *xattr_name,
+                       u64 valid, const char *xattr_name,
                        const char *input, int input_size, int output_size,
                        int flags, __u32 suppgid,
                        struct ptlrpc_request **request)
 {
                        const char *input, int input_size, int output_size,
                        int flags, __u32 suppgid,
                        struct ptlrpc_request **request)
 {
-        return mdc_xattr_common(exp, &RQF_MDS_REINT_SETXATTR,
-                                fid, oc, MDS_REINT, valid, xattr_name,
-                                input, input_size, output_size, flags,
-                                suppgid, request);
+       return mdc_xattr_common(exp, &RQF_MDS_REINT_SETXATTR,
+                               fid, MDS_REINT, valid, xattr_name,
+                               input, input_size, output_size, flags,
+                               suppgid, request);
 }
 
 static int mdc_getxattr(struct obd_export *exp, const struct lu_fid *fid,
 }
 
 static int mdc_getxattr(struct obd_export *exp, const struct lu_fid *fid,
-                       struct obd_capa *oc, u64 valid,
-                       const char *xattr_name,
+                       u64 valid, const char *xattr_name,
                        const char *input, int input_size, int output_size,
                        int flags, struct ptlrpc_request **request)
 {
                        const char *input, int input_size, int output_size,
                        int flags, struct ptlrpc_request **request)
 {
-        return mdc_xattr_common(exp, &RQF_MDS_GETXATTR,
-                                fid, oc, MDS_GETXATTR, valid, xattr_name,
-                                input, input_size, output_size, flags,
-                                -1, request);
+       return mdc_xattr_common(exp, &RQF_MDS_GETXATTR,
+                               fid, MDS_GETXATTR, valid, xattr_name,
+                               input, input_size, output_size, flags,
+                               -1, request);
 }
 
 #ifdef CONFIG_FS_POSIX_ACL
 }
 
 #ifdef CONFIG_FS_POSIX_ACL
@@ -583,35 +522,10 @@ int mdc_get_lustre_md(struct obd_export *exp, struct ptlrpc_request *req,
 #endif
                 }
         }
 #endif
                 }
         }
-       if (md->body->mbo_valid & OBD_MD_FLMDSCAPA) {
-                struct obd_capa *oc = NULL;
-
-                rc = mdc_unpack_capa(NULL, req, &RMF_CAPA1, &oc);
-                if (rc)
-                        GOTO(out, rc);
-                md->mds_capa = oc;
-        }
-
-       if (md->body->mbo_valid & OBD_MD_FLOSSCAPA) {
-                struct obd_capa *oc = NULL;
-
-                rc = mdc_unpack_capa(NULL, req, &RMF_CAPA2, &oc);
-                if (rc)
-                        GOTO(out, rc);
-                md->oss_capa = oc;
-        }
 
         EXIT;
 out:
         if (rc) {
 
         EXIT;
 out:
         if (rc) {
-                if (md->oss_capa) {
-                        capa_put(md->oss_capa);
-                        md->oss_capa = NULL;
-                }
-                if (md->mds_capa) {
-                        capa_put(md->mds_capa);
-                        md->mds_capa = NULL;
-                }
 #ifdef CONFIG_FS_POSIX_ACL
                 posix_acl_release(md->posix_acl);
 #endif
 #ifdef CONFIG_FS_POSIX_ACL
                 posix_acl_release(md->posix_acl);
 #endif
@@ -840,8 +754,6 @@ static int mdc_close(struct obd_export *exp, struct md_op_data *op_data,
         if (req == NULL)
                 RETURN(-ENOMEM);
 
         if (req == NULL)
                 RETURN(-ENOMEM);
 
-        mdc_set_capa_size(req, &RMF_CAPA1, op_data->op_capa1);
-
         rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, MDS_CLOSE);
         if (rc) {
                 ptlrpc_request_free(req);
         rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, MDS_CLOSE);
         if (rc) {
                 ptlrpc_request_free(req);
@@ -928,8 +840,7 @@ static int mdc_close(struct obd_export *exp, struct md_op_data *op_data,
 }
 
 static int mdc_getpage(struct obd_export *exp, const struct lu_fid *fid,
 }
 
 static int mdc_getpage(struct obd_export *exp, const struct lu_fid *fid,
-                      __u64 offset, struct obd_capa *oc,
-                      struct page **pages, int npages,
+                      u64 offset, struct page **pages, int npages,
                       struct ptlrpc_request **request)
 {
        struct ptlrpc_request   *req;
                       struct ptlrpc_request **request)
 {
        struct ptlrpc_request   *req;
@@ -949,8 +860,6 @@ restart_bulk:
        if (req == NULL)
                RETURN(-ENOMEM);
 
        if (req == NULL)
                RETURN(-ENOMEM);
 
-       mdc_set_capa_size(req, &RMF_CAPA1, oc);
-
        rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, MDS_READPAGE);
        if (rc) {
                ptlrpc_request_free(req);
        rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, MDS_READPAGE);
        if (rc) {
                ptlrpc_request_free(req);
@@ -974,7 +883,7 @@ restart_bulk:
                desc->bd_frag_ops->add_kiov_frag(desc, pages[i], 0,
                                                 PAGE_CACHE_SIZE);
 
                desc->bd_frag_ops->add_kiov_frag(desc, pages[i], 0,
                                                 PAGE_CACHE_SIZE);
 
-       mdc_readdir_pack(req, offset, PAGE_CACHE_SIZE * npages, fid, oc);
+       mdc_readdir_pack(req, offset, PAGE_CACHE_SIZE * npages, fid);
 
        ptlrpc_request_set_replen(req);
        rc = ptlrpc_queue_wait(req);
 
        ptlrpc_request_set_replen(req);
        rc = ptlrpc_queue_wait(req);
@@ -1267,8 +1176,7 @@ static int mdc_read_page_remote(void *data, struct page *page0)
                page_pool[npages] = page;
        }
 
                page_pool[npages] = page;
        }
 
-       rc = mdc_getpage(rp->rp_exp, fid, rp->rp_off, op_data->op_capa1,
-                        page_pool, npages, &req);
+       rc = mdc_getpage(rp->rp_exp, fid, rp->rp_off, page_pool, npages, &req);
        if (rc < 0) {
                /* page0 is special, which was added into page cache early */
                delete_from_page_cache(page0);
        if (rc < 0) {
                /* page0 is special, which was added into page cache early */
                delete_from_page_cache(page0);
@@ -1593,7 +1501,7 @@ static int mdc_ioc_hsm_progress(struct obd_export *exp,
        if (req == NULL)
                GOTO(out, rc = -ENOMEM);
 
        if (req == NULL)
                GOTO(out, rc = -ENOMEM);
 
-       mdc_pack_body(req, NULL, NULL, OBD_MD_FLRMTPERM, 0, -1, 0);
+       mdc_pack_body(req, NULL, OBD_MD_FLRMTPERM, 0, -1, 0);
 
        /* Copy hsm_progress struct */
        req_hpk = req_capsule_client_get(&req->rq_pill, &RMF_MDS_HSM_PROGRESS);
 
        /* Copy hsm_progress struct */
        req_hpk = req_capsule_client_get(&req->rq_pill, &RMF_MDS_HSM_PROGRESS);
@@ -1628,7 +1536,7 @@ static int mdc_ioc_hsm_ct_register(struct obd_import *imp, __u32 archives)
        if (req == NULL)
                GOTO(out, rc = -ENOMEM);
 
        if (req == NULL)
                GOTO(out, rc = -ENOMEM);
 
-       mdc_pack_body(req, NULL, NULL, OBD_MD_FLRMTPERM, 0, -1, 0);
+       mdc_pack_body(req, NULL, OBD_MD_FLRMTPERM, 0, -1, 0);
 
        /* Copy hsm_progress struct */
        archive_mask = req_capsule_client_get(&req->rq_pill,
 
        /* Copy hsm_progress struct */
        archive_mask = req_capsule_client_get(&req->rq_pill,
@@ -1661,16 +1569,14 @@ static int mdc_ioc_hsm_current_action(struct obd_export *exp,
        if (req == NULL)
                RETURN(-ENOMEM);
 
        if (req == NULL)
                RETURN(-ENOMEM);
 
-       mdc_set_capa_size(req, &RMF_CAPA1, op_data->op_capa1);
-
        rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, MDS_HSM_ACTION);
        if (rc) {
                ptlrpc_request_free(req);
                RETURN(rc);
        }
 
        rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, MDS_HSM_ACTION);
        if (rc) {
                ptlrpc_request_free(req);
                RETURN(rc);
        }
 
-       mdc_pack_body(req, &op_data->op_fid1, op_data->op_capa1,
-                     OBD_MD_FLRMTPERM, 0, op_data->op_suppgids[0], 0);
+       mdc_pack_body(req, &op_data->op_fid1, OBD_MD_FLRMTPERM, 0,
+                     op_data->op_suppgids[0], 0);
 
        ptlrpc_request_set_replen(req);
 
 
        ptlrpc_request_set_replen(req);
 
@@ -1703,7 +1609,7 @@ static int mdc_ioc_hsm_ct_unregister(struct obd_import *imp)
        if (req == NULL)
                GOTO(out, rc = -ENOMEM);
 
        if (req == NULL)
                GOTO(out, rc = -ENOMEM);
 
-       mdc_pack_body(req, NULL, NULL, OBD_MD_FLRMTPERM, 0, -1, 0);
+       mdc_pack_body(req, NULL, OBD_MD_FLRMTPERM, 0, -1, 0);
 
        ptlrpc_request_set_replen(req);
 
 
        ptlrpc_request_set_replen(req);
 
@@ -1728,16 +1634,14 @@ static int mdc_ioc_hsm_state_get(struct obd_export *exp,
        if (req == NULL)
                RETURN(-ENOMEM);
 
        if (req == NULL)
                RETURN(-ENOMEM);
 
-       mdc_set_capa_size(req, &RMF_CAPA1, op_data->op_capa1);
-
        rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, MDS_HSM_STATE_GET);
        if (rc != 0) {
                ptlrpc_request_free(req);
                RETURN(rc);
        }
 
        rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, MDS_HSM_STATE_GET);
        if (rc != 0) {
                ptlrpc_request_free(req);
                RETURN(rc);
        }
 
-       mdc_pack_body(req, &op_data->op_fid1, op_data->op_capa1,
-                     OBD_MD_FLRMTPERM, 0, op_data->op_suppgids[0], 0);
+       mdc_pack_body(req, &op_data->op_fid1, OBD_MD_FLRMTPERM, 0,
+                     op_data->op_suppgids[0], 0);
 
        ptlrpc_request_set_replen(req);
 
 
        ptlrpc_request_set_replen(req);
 
@@ -1771,16 +1675,14 @@ static int mdc_ioc_hsm_state_set(struct obd_export *exp,
        if (req == NULL)
                RETURN(-ENOMEM);
 
        if (req == NULL)
                RETURN(-ENOMEM);
 
-       mdc_set_capa_size(req, &RMF_CAPA1, op_data->op_capa1);
-
        rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, MDS_HSM_STATE_SET);
        if (rc) {
                ptlrpc_request_free(req);
                RETURN(rc);
        }
 
        rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, MDS_HSM_STATE_SET);
        if (rc) {
                ptlrpc_request_free(req);
                RETURN(rc);
        }
 
-       mdc_pack_body(req, &op_data->op_fid1, op_data->op_capa1,
-                     OBD_MD_FLRMTPERM, 0, op_data->op_suppgids[0], 0);
+       mdc_pack_body(req, &op_data->op_fid1, OBD_MD_FLRMTPERM, 0,
+                     op_data->op_suppgids[0], 0);
 
        /* Copy states */
        req_hss = req_capsule_client_get(&req->rq_pill, &RMF_HSM_STATE_SET);
 
        /* Copy states */
        req_hss = req_capsule_client_get(&req->rq_pill, &RMF_HSM_STATE_SET);
@@ -1827,7 +1729,7 @@ static int mdc_ioc_hsm_request(struct obd_export *exp,
                RETURN(rc);
        }
 
                RETURN(rc);
        }
 
-       mdc_pack_body(req, NULL, NULL, OBD_MD_FLRMTPERM, 0, -1, 0);
+       mdc_pack_body(req, NULL, OBD_MD_FLRMTPERM, 0, -1, 0);
 
        /* Copy hsm_request struct */
        req_hr = req_capsule_client_get(&req->rq_pill, &RMF_MDS_HSM_REQUEST);
 
        /* Copy hsm_request struct */
        req_hr = req_capsule_client_get(&req->rq_pill, &RMF_MDS_HSM_REQUEST);
@@ -2097,9 +1999,6 @@ static int mdc_ioc_swap_layouts(struct obd_export *exp,
                RETURN(-ENOMEM);
        }
 
                RETURN(-ENOMEM);
        }
 
-       mdc_set_capa_size(req, &RMF_CAPA1, op_data->op_capa1);
-       mdc_set_capa_size(req, &RMF_CAPA2, op_data->op_capa2);
-
        rc = mdc_prep_elc_req(exp, req, MDS_SWAP_LAYOUTS, &cancels, count);
        if (rc) {
                ptlrpc_request_free(req);
        rc = mdc_prep_elc_req(exp, req, MDS_SWAP_LAYOUTS, &cancels, count);
        if (rc) {
                ptlrpc_request_free(req);
@@ -2542,7 +2441,7 @@ static int mdc_get_info(const struct lu_env *env, struct obd_export *exp,
 }
 
 static int mdc_fsync(struct obd_export *exp, const struct lu_fid *fid,
 }
 
 static int mdc_fsync(struct obd_export *exp, const struct lu_fid *fid,
-                    struct obd_capa *oc, struct ptlrpc_request **request)
+                    struct ptlrpc_request **request)
 {
         struct ptlrpc_request *req;
         int                    rc;
 {
         struct ptlrpc_request *req;
         int                    rc;
@@ -2553,15 +2452,13 @@ static int mdc_fsync(struct obd_export *exp, const struct lu_fid *fid,
         if (req == NULL)
                 RETURN(-ENOMEM);
 
         if (req == NULL)
                 RETURN(-ENOMEM);
 
-        mdc_set_capa_size(req, &RMF_CAPA1, oc);
-
         rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, MDS_SYNC);
         if (rc) {
                 ptlrpc_request_free(req);
                 RETURN(rc);
         }
 
         rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, MDS_SYNC);
         if (rc) {
                 ptlrpc_request_free(req);
                 RETURN(rc);
         }
 
-        mdc_pack_body(req, fid, oc, 0, 0, -1, 0);
+       mdc_pack_body(req, fid, 0, 0, -1, 0);
 
         ptlrpc_request_set_replen(req);
 
 
         ptlrpc_request_set_replen(req);
 
@@ -2830,8 +2727,7 @@ static int mdc_process_config(struct obd_device *obd, size_t len, void *buf)
 
 /* get remote permission for current user on fid */
 static int mdc_get_remote_perm(struct obd_export *exp, const struct lu_fid *fid,
 
 /* get remote permission for current user on fid */
 static int mdc_get_remote_perm(struct obd_export *exp, const struct lu_fid *fid,
-                              struct obd_capa *oc, __u32 suppgid,
-                              struct ptlrpc_request **request)
+                              u32 suppgid, struct ptlrpc_request **request)
 {
         struct ptlrpc_request  *req;
         int                    rc;
 {
         struct ptlrpc_request  *req;
         int                    rc;
@@ -2844,15 +2740,13 @@ static int mdc_get_remote_perm(struct obd_export *exp, const struct lu_fid *fid,
         if (req == NULL)
                 RETURN(-ENOMEM);
 
         if (req == NULL)
                 RETURN(-ENOMEM);
 
-        mdc_set_capa_size(req, &RMF_CAPA1, oc);
-
         rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, MDS_GETATTR);
         if (rc) {
                 ptlrpc_request_free(req);
                 RETURN(rc);
         }
 
         rc = ptlrpc_request_pack(req, LUSTRE_MDS_VERSION, MDS_GETATTR);
         if (rc) {
                 ptlrpc_request_free(req);
                 RETURN(rc);
         }
 
-        mdc_pack_body(req, fid, oc, OBD_MD_FLRMTPERM, 0, suppgid, 0);
+       mdc_pack_body(req, fid, OBD_MD_FLRMTPERM, 0, suppgid, 0);
 
         req_capsule_set_size(&req->rq_pill, &RMF_ACL, RCL_SERVER,
                              sizeof(struct mdt_remote_perm));
 
         req_capsule_set_size(&req->rq_pill, &RMF_ACL, RCL_SERVER,
                              sizeof(struct mdt_remote_perm));
@@ -2867,61 +2761,6 @@ static int mdc_get_remote_perm(struct obd_export *exp, const struct lu_fid *fid,
         RETURN(rc);
 }
 
         RETURN(rc);
 }
 
-static int mdc_interpret_renew_capa(const struct lu_env *env,
-                                    struct ptlrpc_request *req, void *args,
-                                    int status)
-{
-        struct mdc_renew_capa_args *ra = args;
-        struct mdt_body *body = NULL;
-        struct lustre_capa *capa;
-        ENTRY;
-
-        if (status)
-                GOTO(out, capa = ERR_PTR(status));
-
-        body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
-        if (body == NULL)
-                GOTO(out, capa = ERR_PTR(-EFAULT));
-
-       if ((body->mbo_valid & OBD_MD_FLOSSCAPA) == 0)
-                GOTO(out, capa = ERR_PTR(-ENOENT));
-
-        capa = req_capsule_server_get(&req->rq_pill, &RMF_CAPA2);
-        if (!capa)
-                GOTO(out, capa = ERR_PTR(-EFAULT));
-        EXIT;
-out:
-        ra->ra_cb(ra->ra_oc, capa);
-        return 0;
-}
-
-static int mdc_renew_capa(struct obd_export *exp, struct obd_capa *oc,
-                          renew_capa_cb_t cb)
-{
-        struct ptlrpc_request *req;
-        struct mdc_renew_capa_args *ra;
-        ENTRY;
-
-        req = ptlrpc_request_alloc_pack(class_exp2cliimp(exp), &RQF_MDS_GETATTR,
-                                        LUSTRE_MDS_VERSION, MDS_GETATTR);
-        if (req == NULL)
-                RETURN(-ENOMEM);
-
-        /* NB, OBD_MD_FLOSSCAPA is set here, but it doesn't necessarily mean the
-         * capa to renew is oss capa.
-         */
-        mdc_pack_body(req, &oc->c_capa.lc_fid, oc, OBD_MD_FLOSSCAPA, 0, -1, 0);
-        ptlrpc_request_set_replen(req);
-
-        CLASSERT(sizeof(*ra) <= sizeof(req->rq_async_args));
-        ra = ptlrpc_req_async_args(req);
-        ra->ra_oc = oc;
-        ra->ra_cb = cb;
-        req->rq_interpret_reply = mdc_interpret_renew_capa;
-        ptlrpcd_add_req(req, PDL_POLICY_LOCAL, -1);
-        RETURN(0);
-}
-
 static struct obd_ops mdc_obd_ops = {
         .o_owner            = THIS_MODULE,
         .o_setup            = mdc_setup,
 static struct obd_ops mdc_obd_ops = {
         .o_owner            = THIS_MODULE,
         .o_setup            = mdc_setup,
@@ -2970,8 +2809,6 @@ static struct md_ops mdc_md_ops = {
         .m_free_lustre_md   = mdc_free_lustre_md,
         .m_set_open_replay_data = mdc_set_open_replay_data,
         .m_clear_open_replay_data = mdc_clear_open_replay_data,
         .m_free_lustre_md   = mdc_free_lustre_md,
         .m_set_open_replay_data = mdc_set_open_replay_data,
         .m_clear_open_replay_data = mdc_clear_open_replay_data,
-        .m_renew_capa       = mdc_renew_capa,
-        .m_unpack_capa      = mdc_unpack_capa,
         .m_get_remote_perm  = mdc_get_remote_perm,
         .m_intent_getattr_async = mdc_intent_getattr_async,
         .m_revalidate_lock      = mdc_revalidate_lock
         .m_get_remote_perm  = mdc_get_remote_perm,
         .m_intent_getattr_async = mdc_intent_getattr_async,
         .m_revalidate_lock      = mdc_revalidate_lock
index 3370b8c..ca11c1b 100644 (file)
@@ -10,7 +10,7 @@ obdclass-all-objs += class_obd.o debug.o genops.o uuid.o llog_ioctl.o
 obdclass-all-objs += lprocfs_status.o lprocfs_counters.o
 obdclass-all-objs += lustre_handles.o lustre_peer.o local_storage.o
 obdclass-all-objs += statfs_pack.o obdo.o obd_config.o obd_mount.o
 obdclass-all-objs += lprocfs_status.o lprocfs_counters.o
 obdclass-all-objs += lustre_handles.o lustre_peer.o local_storage.o
 obdclass-all-objs += statfs_pack.o obdo.o obd_config.o obd_mount.o
-obdclass-all-objs += lu_object.o dt_object.o capa.o
+obdclass-all-objs += lu_object.o dt_object.o
 obdclass-all-objs += cl_object.o cl_page.o cl_lock.o cl_io.o lu_ref.o
 obdclass-all-objs += acl.o
 obdclass-all-objs += linkea.o
 obdclass-all-objs += cl_object.o cl_page.o cl_lock.o cl_io.o lu_ref.o
 obdclass-all-objs += acl.o
 obdclass-all-objs += linkea.o
diff --git a/lustre/obdclass/capa.c b/lustre/obdclass/capa.c
deleted file mode 100644 (file)
index b3db16e..0000000
+++ /dev/null
@@ -1,447 +0,0 @@
-/*
- * 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 (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Use is subject to license terms.
- *
- * Copyright (c) 2012, 2014, Intel Corporation.
- */
-/*
- * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
- *
- * lustre/obdclass/capa.c
- *
- * Lustre Capability Hash Management
- *
- * Author: Lai Siyao<lsy@clusterfs.com>
- */
-
-#define DEBUG_SUBSYSTEM S_SEC
-
-#include <linux/version.h>
-#include <linux/fs.h>
-#include <asm/unistd.h>
-#include <linux/slab.h>
-#include <linux/module.h>
-#include <linux/init.h>
-
-#include <obd_class.h>
-#include <lustre_debug.h>
-#include <lustre/lustre_idl.h>
-
-#include <libcfs/list.h>
-#include <lustre_capa.h>
-
-#define NR_CAPAHASH 32
-#define CAPA_HASH_SIZE 3000              /* for MDS & OSS */
-
-struct kmem_cache *capa_cachep;
-
-/* lock for capa hash/capa_list/fo_capa_keys */
-DEFINE_SPINLOCK(capa_lock);
-
-struct list_head capa_list[CAPA_SITE_MAX];
-
-static struct capa_hmac_alg capa_hmac_algs[] = {
-        DEF_CAPA_HMAC_ALG("sha1", SHA1, 20, 20),
-};
-/* capa count */
-int capa_count[CAPA_SITE_MAX] = { 0, };
-
-EXPORT_SYMBOL(capa_cachep);
-EXPORT_SYMBOL(capa_list);
-EXPORT_SYMBOL(capa_lock);
-EXPORT_SYMBOL(capa_count);
-
-struct hlist_head *init_capa_hash(void)
-{
-       struct hlist_head *hash;
-       int nr_hash, i;
-
-       OBD_ALLOC(hash, PAGE_CACHE_SIZE);
-       if (!hash)
-               return NULL;
-
-       nr_hash = PAGE_CACHE_SIZE / sizeof(struct hlist_head);
-       LASSERT(nr_hash > NR_CAPAHASH);
-
-       for (i = 0; i < NR_CAPAHASH; i++)
-               INIT_HLIST_HEAD(hash + i);
-       return hash;
-}
-EXPORT_SYMBOL(init_capa_hash);
-
-static inline int capa_on_server(struct obd_capa *ocapa)
-{
-        return ocapa->c_site == CAPA_SITE_SERVER;
-}
-
-static inline void capa_delete(struct obd_capa *ocapa)
-{
-       LASSERT(capa_on_server(ocapa));
-       hlist_del_init(&ocapa->u.tgt.c_hash);
-       list_del_init(&ocapa->c_list);
-       capa_count[ocapa->c_site]--;
-       /* release the ref when alloc */
-       capa_put(ocapa);
-}
-
-void cleanup_capa_hash(struct hlist_head *hash)
-{
-       struct hlist_node __maybe_unused *pos;
-       struct hlist_node *next;
-       struct obd_capa *oc;
-       int i;
-
-       spin_lock(&capa_lock);
-       for (i = 0; i < NR_CAPAHASH; i++) {
-               cfs_hlist_for_each_entry_safe(oc, pos, next, hash + i,
-                                             u.tgt.c_hash)
-                       capa_delete(oc);
-       }
-       spin_unlock(&capa_lock);
-
-       OBD_FREE(hash, PAGE_CACHE_SIZE);
-}
-EXPORT_SYMBOL(cleanup_capa_hash);
-
-static inline int capa_hashfn(struct lu_fid *fid)
-{
-        return (fid_oid(fid) ^ fid_ver(fid)) *
-               (unsigned long)(fid_seq(fid) + 1) % NR_CAPAHASH;
-}
-
-/* capa renewal time check is earlier than that on client, which is to prevent
- * client renew right after obtaining it. */
-static inline int capa_is_to_expire(struct obd_capa *oc)
-{
-        return cfs_time_before(cfs_time_sub(oc->c_expiry,
-                                   cfs_time_seconds(oc->c_capa.lc_timeout)*2/3),
-                               cfs_time_current());
-}
-
-static struct obd_capa *find_capa(struct lustre_capa *capa,
-                                 struct hlist_head *head, int alive)
-{
-       struct hlist_node __maybe_unused *pos;
-       struct obd_capa *ocapa;
-       int len = alive ? offsetof(struct lustre_capa, lc_keyid):sizeof(*capa);
-
-       cfs_hlist_for_each_entry(ocapa, pos, head, u.tgt.c_hash) {
-               if (memcmp(&ocapa->c_capa, capa, len))
-                       continue;
-               /* don't return one that will expire soon in this case */
-               if (alive && capa_is_to_expire(ocapa))
-                       continue;
-
-                LASSERT(capa_on_server(ocapa));
-
-                DEBUG_CAPA(D_SEC, &ocapa->c_capa, "found");
-                return ocapa;
-        }
-
-        return NULL;
-}
-
-#define LRU_CAPA_DELETE_COUNT 12
-static inline void capa_delete_lru(struct list_head *head)
-{
-       struct obd_capa *ocapa;
-       struct list_head *node = head->next;
-       int count = 0;
-
-       /* free LRU_CAPA_DELETE_COUNT unused capa from head */
-       while (count++ < LRU_CAPA_DELETE_COUNT) {
-               ocapa = list_entry(node, struct obd_capa, c_list);
-               node = node->next;
-               if (atomic_read(&ocapa->c_refc))
-                       continue;
-
-               DEBUG_CAPA(D_SEC, &ocapa->c_capa, "free lru");
-               capa_delete(ocapa);
-       }
-}
-
-/* add or update */
-struct obd_capa *capa_add(struct hlist_head *hash, struct lustre_capa *capa)
-{
-       struct hlist_head *head = hash + capa_hashfn(&capa->lc_fid);
-        struct obd_capa *ocapa, *old = NULL;
-       struct list_head *list = &capa_list[CAPA_SITE_SERVER];
-
-        ocapa = alloc_capa(CAPA_SITE_SERVER);
-        if (IS_ERR(ocapa))
-                return NULL;
-
-       spin_lock(&capa_lock);
-        old = find_capa(capa, head, 0);
-        if (!old) {
-                ocapa->c_capa = *capa;
-                set_capa_expiry(ocapa);
-               hlist_add_head(&ocapa->u.tgt.c_hash, head);
-               list_add_tail(&ocapa->c_list, list);
-                capa_get(ocapa);
-                capa_count[CAPA_SITE_SERVER]++;
-                if (capa_count[CAPA_SITE_SERVER] > CAPA_HASH_SIZE)
-                        capa_delete_lru(list);
-               spin_unlock(&capa_lock);
-               return ocapa;
-       } else {
-               capa_get(old);
-               spin_unlock(&capa_lock);
-               capa_put(ocapa);
-               return old;
-       }
-}
-EXPORT_SYMBOL(capa_add);
-
-struct obd_capa *capa_lookup(struct hlist_head *hash, struct lustre_capa *capa,
-                            int alive)
-{
-       struct obd_capa *ocapa;
-
-       spin_lock(&capa_lock);
-       ocapa = find_capa(capa, hash + capa_hashfn(&capa->lc_fid), alive);
-       if (ocapa) {
-               list_move_tail(&ocapa->c_list, &capa_list[CAPA_SITE_SERVER]);
-               capa_get(ocapa);
-       }
-       spin_unlock(&capa_lock);
-
-       return ocapa;
-}
-EXPORT_SYMBOL(capa_lookup);
-
-int capa_hmac(__u8 *hmac, struct lustre_capa *capa, __u8 *key)
-{
-       struct crypto_hash *tfm;
-        struct capa_hmac_alg  *alg;
-        int keylen;
-        struct scatterlist sl;
-
-        if (capa_alg(capa) != CAPA_HMAC_ALG_SHA1) {
-                CERROR("unknown capability hmac algorithm!\n");
-                return -EFAULT;
-        }
-
-        alg = &capa_hmac_algs[capa_alg(capa)];
-
-       tfm = crypto_alloc_hash(alg->ha_name, 0, 0);
-        if (IS_ERR(tfm)) {
-                CERROR("crypto_alloc_tfm failed, check whether your kernel"
-                       "has crypto support!\n");
-                return PTR_ERR(tfm);
-        }
-        keylen = alg->ha_keylen;
-
-       sg_init_table(&sl, 1);
-        sg_set_page(&sl, virt_to_page(capa),
-                    offsetof(struct lustre_capa, lc_hmac),
-                   (unsigned long)(capa) % PAGE_CACHE_SIZE);
-
-        ll_crypto_hmac(tfm, key, &keylen, &sl, sl.length, hmac);
-       crypto_free_hash(tfm);
-
-        return 0;
-}
-EXPORT_SYMBOL(capa_hmac);
-
-int capa_encrypt_id(__u32 *d, __u32 *s, __u8 *key, int keylen)
-{
-       struct crypto_blkcipher *tfm;
-        struct scatterlist sd;
-        struct scatterlist ss;
-        struct blkcipher_desc desc;
-        unsigned int min;
-        int rc;
-        char alg[CRYPTO_MAX_ALG_NAME+1] = "aes";
-        ENTRY;
-
-       /* passing "aes" in a variable instead of a constant string keeps gcc
-        * 4.3.2 happy */
-       tfm = crypto_alloc_blkcipher(alg, 0, 0 );
-       if (IS_ERR(tfm)) {
-               CERROR("failed to load transform for aes\n");
-               RETURN(PTR_ERR(tfm));
-       }
-
-        min = ll_crypto_tfm_alg_min_keysize(tfm);
-        if (keylen < min) {
-                CERROR("keylen at least %d bits for aes\n", min * 8);
-                GOTO(out, rc = -EINVAL);
-        }
-
-       rc = crypto_blkcipher_setkey(tfm, key, min);
-        if (rc) {
-                CERROR("failed to setting key for aes\n");
-                GOTO(out, rc);
-        }
-
-       sg_init_table(&sd, 1);
-       sg_set_page(&sd, virt_to_page(d), 16,
-                   (unsigned long)(d) % PAGE_CACHE_SIZE);
-
-       sg_init_table(&ss, 1);
-       sg_set_page(&ss, virt_to_page(s), 16,
-                   (unsigned long)(s) % PAGE_CACHE_SIZE);
-        desc.tfm   = tfm;
-        desc.info  = NULL;
-        desc.flags = 0;
-       rc = crypto_blkcipher_encrypt(&desc, &sd, &ss, 16);
-        if (rc) {
-                CERROR("failed to encrypt for aes\n");
-                GOTO(out, rc);
-        }
-
-        EXIT;
-
-out:
-       crypto_free_blkcipher(tfm);
-        return rc;
-}
-EXPORT_SYMBOL(capa_encrypt_id);
-
-int capa_decrypt_id(__u32 *d, __u32 *s, __u8 *key, int keylen)
-{
-       struct crypto_blkcipher *tfm;
-        struct scatterlist sd;
-        struct scatterlist ss;
-        struct blkcipher_desc desc;
-        unsigned int min;
-        int rc;
-        char alg[CRYPTO_MAX_ALG_NAME+1] = "aes";
-        ENTRY;
-
-       /* passing "aes" in a variable instead of a constant string keeps gcc
-        * 4.3.2 happy */
-       tfm = crypto_alloc_blkcipher(alg, 0, 0 );
-       if (IS_ERR(tfm)) {
-               CERROR("failed to load transform for aes\n");
-               RETURN(PTR_ERR(tfm));
-       }
-
-        min = ll_crypto_tfm_alg_min_keysize(tfm);
-        if (keylen < min) {
-                CERROR("keylen at least %d bits for aes\n", min * 8);
-                GOTO(out, rc = -EINVAL);
-        }
-
-       rc = crypto_blkcipher_setkey(tfm, key, min);
-        if (rc) {
-                CERROR("failed to setting key for aes\n");
-                GOTO(out, rc);
-        }
-
-       sg_init_table(&sd, 1);
-       sg_set_page(&sd, virt_to_page(d), 16,
-                   (unsigned long)(d) % PAGE_CACHE_SIZE);
-
-       sg_init_table(&ss, 1);
-       sg_set_page(&ss, virt_to_page(s), 16,
-                   (unsigned long)(s) % PAGE_CACHE_SIZE);
-
-        desc.tfm   = tfm;
-        desc.info  = NULL;
-        desc.flags = 0;
-       rc = crypto_blkcipher_decrypt(&desc, &sd, &ss, 16);
-        if (rc) {
-                CERROR("failed to decrypt for aes\n");
-                GOTO(out, rc);
-        }
-
-        EXIT;
-
-out:
-       crypto_free_blkcipher(tfm);
-        return rc;
-}
-
-void capa_cpy(void *capa, struct obd_capa *ocapa)
-{
-       spin_lock(&ocapa->c_lock);
-       *(struct lustre_capa *)capa = ocapa->c_capa;
-       spin_unlock(&ocapa->c_lock);
-}
-EXPORT_SYMBOL(capa_cpy);
-
-void _debug_capa(struct lustre_capa *c,
-                 struct libcfs_debug_msg_data *msgdata,
-                 const char *fmt, ... )
-{
-        va_list args;
-        va_start(args, fmt);
-        libcfs_debug_vmsg2(msgdata, fmt, args,
-                           " capability@%p fid "DFID" opc "LPX64" uid "LPU64
-                           " gid "LPU64" flags %u alg %d keyid %u timeout %u "
-                           "expiry %u\n", c, PFID(capa_fid(c)), capa_opc(c),
-                           capa_uid(c), capa_gid(c), capa_flags(c),
-                           capa_alg(c), capa_keyid(c), capa_timeout(c),
-                           capa_expiry(c));
-        va_end(args);
-}
-EXPORT_SYMBOL(_debug_capa);
-
-/*
- * context key constructor/destructor:
- * lu_capainfo_key_init, lu_capainfo_key_fini
- */
-LU_KEY_INIT_FINI(lu_capainfo, struct lu_capainfo);
-
-static struct lu_context_key lu_capainfo_key = {
-       .lct_tags = LCT_SERVER_SESSION,
-       .lct_init = lu_capainfo_key_init,
-       .lct_fini = lu_capainfo_key_fini
-};
-
-struct lu_capainfo *lu_capainfo_get(const struct lu_env *env)
-{
-       /* NB, in mdt_init0 */
-       if (env->le_ses == NULL)
-               return NULL;
-       return lu_context_key_get(env->le_ses, &lu_capainfo_key);
-}
-EXPORT_SYMBOL(lu_capainfo_get);
-
-/**
- * Initialization of lu_capainfo_key data.
- */
-int lu_capainfo_init(void)
-{
-       int rc;
-
-       LU_CONTEXT_KEY_INIT(&lu_capainfo_key);
-       rc = lu_context_key_register(&lu_capainfo_key);
-       return rc;
-}
-
-/**
- * Dual to lu_capainfo_init().
- */
-void lu_capainfo_fini(void)
-{
-       lu_context_key_degister(&lu_capainfo_key);
-}
index ba93853..9855708 100644 (file)
@@ -513,9 +513,6 @@ static int __init init_obdclass(void)
 {
         int i, err;
 
 {
         int i, err;
 
-        for (i = CAPA_SITE_CLIENT; i < CAPA_SITE_MAX; i++)
-               INIT_LIST_HEAD(&capa_list[i]);
-
         LCONSOLE_INFO("Lustre: Build Version: "BUILD_VERSION"\n");
 
        spin_lock_init(&obd_types_lock);
         LCONSOLE_INFO("Lustre: Build Version: "BUILD_VERSION"\n");
 
        spin_lock_init(&obd_types_lock);
@@ -576,10 +573,6 @@ static int __init init_obdclass(void)
        if (err)
                return err;
 
        if (err)
                return err;
 
-       err = lu_capainfo_init();
-       if (err)
-               return err;
-
        err = cl_global_init();
        if (err != 0)
                return err;
        err = cl_global_init();
        if (err != 0)
                return err;
@@ -660,7 +653,6 @@ static void cleanup_obdclass(void)
        dt_global_fini();
 #endif /* HAVE_SERVER_SUPPORT */
        cl_global_fini();
        dt_global_fini();
 #endif /* HAVE_SERVER_SUPPORT */
        cl_global_fini();
-       lu_capainfo_fini();
        lu_global_fini();
 
         obd_cleanup_caches();
        lu_global_fini();
 
         obd_cleanup_caches();
index 2809176..24b8caa 100644 (file)
@@ -661,10 +661,7 @@ void obd_cleanup_caches(void)
                kmem_cache_destroy(import_cachep);
                 import_cachep = NULL;
         }
                kmem_cache_destroy(import_cachep);
                 import_cachep = NULL;
         }
-        if (capa_cachep) {
-               kmem_cache_destroy(capa_cachep);
-                capa_cachep = NULL;
-        }
+
         EXIT;
 }
 
         EXIT;
 }
 
@@ -693,12 +690,6 @@ int obd_init_caches(void)
        if (!import_cachep)
                GOTO(out, rc = -ENOMEM);
 
        if (!import_cachep)
                GOTO(out, rc = -ENOMEM);
 
-       LASSERT(capa_cachep == NULL);
-       capa_cachep = kmem_cache_create("capa_cache", sizeof(struct obd_capa),
-                                       0, 0, NULL);
-       if (!capa_cachep)
-               GOTO(out, rc = -ENOMEM);
-
        RETURN(0);
 out:
        obd_cleanup_caches();
        RETURN(0);
 out:
        obd_cleanup_caches();
index c8ce66c..3b878f6 100644 (file)
@@ -1374,8 +1374,6 @@ void lprocfs_init_mps_stats(int num_private_stats, struct lprocfs_stats *stats)
         LPROCFS_MD_OP_INIT(num_private_stats, stats, set_lock_data);
         LPROCFS_MD_OP_INIT(num_private_stats, stats, lock_match);
         LPROCFS_MD_OP_INIT(num_private_stats, stats, cancel_unused);
         LPROCFS_MD_OP_INIT(num_private_stats, stats, set_lock_data);
         LPROCFS_MD_OP_INIT(num_private_stats, stats, lock_match);
         LPROCFS_MD_OP_INIT(num_private_stats, stats, cancel_unused);
-        LPROCFS_MD_OP_INIT(num_private_stats, stats, renew_capa);
-        LPROCFS_MD_OP_INIT(num_private_stats, stats, unpack_capa);
         LPROCFS_MD_OP_INIT(num_private_stats, stats, get_remote_perm);
         LPROCFS_MD_OP_INIT(num_private_stats, stats, intent_getattr_async);
         LPROCFS_MD_OP_INIT(num_private_stats, stats, revalidate_lock);
         LPROCFS_MD_OP_INIT(num_private_stats, stats, get_remote_perm);
         LPROCFS_MD_OP_INIT(num_private_stats, stats, intent_getattr_async);
         LPROCFS_MD_OP_INIT(num_private_stats, stats, revalidate_lock);