[PATCH 46/73] staging/lustre: Remove mds/ost capabilities support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Oleg Drokin <green@xxxxxxxxxxxxxx>

Client capabilities is an outdated feature that never worked properly,
so let's get rid of the client support since modern servers
don't have this support either.

The patch is big, but since it just removes one large feature,
so it's hopefully easy to verify.

Signed-off-by: Oleg Drokin <green@xxxxxxxxxxxxxx>
---
 drivers/staging/lustre/lustre/include/cl_object.h  |   4 -
 drivers/staging/lustre/lustre/include/lclient.h    |   3 +-
 .../lustre/lustre/include/lustre/lustre_idl.h      |  24 -
 .../staging/lustre/lustre/include/lustre_capa.h    | 305 ----------
 drivers/staging/lustre/lustre/include/lustre_mds.h |   5 -
 drivers/staging/lustre/lustre/include/obd.h        |  40 +-
 drivers/staging/lustre/lustre/include/obd_class.h  |  57 +-
 drivers/staging/lustre/lustre/lclient/lcommon_cl.c |  11 +-
 drivers/staging/lustre/lustre/llite/Makefile       |   2 +-
 drivers/staging/lustre/lustre/llite/file.c         |  40 +-
 drivers/staging/lustre/lustre/llite/llite_capa.c   | 661 ---------------------
 .../staging/lustre/lustre/llite/llite_internal.h   |  27 +-
 drivers/staging/lustre/lustre/llite/llite_lib.c    |  71 +--
 drivers/staging/lustre/lustre/llite/namei.c        |  10 +-
 drivers/staging/lustre/lustre/llite/remote_perm.c  |   5 +-
 drivers/staging/lustre/lustre/llite/rw.c           |   8 -
 drivers/staging/lustre/lustre/llite/statahead.c    |  32 +-
 drivers/staging/lustre/lustre/llite/super25.c      |  14 +-
 drivers/staging/lustre/lustre/llite/xattr.c        |  10 +-
 drivers/staging/lustre/lustre/lmv/lmv_obd.c        |  53 +-
 drivers/staging/lustre/lustre/lov/lov_io.c         |   2 -
 drivers/staging/lustre/lustre/lov/lov_obd.c        |  22 +-
 drivers/staging/lustre/lustre/lov/lov_request.c    |   2 -
 drivers/staging/lustre/lustre/mdc/mdc_internal.h   |  18 +-
 drivers/staging/lustre/lustre/mdc/mdc_lib.c        |  48 +-
 drivers/staging/lustre/lustre/mdc/mdc_locks.c      |  37 +-
 drivers/staging/lustre/lustre/mdc/mdc_reint.c      |  19 -
 drivers/staging/lustre/lustre/mdc/mdc_request.c    | 233 ++------
 drivers/staging/lustre/lustre/obdclass/Makefile    |   2 +-
 drivers/staging/lustre/lustre/obdclass/capa.c      | 421 -------------
 drivers/staging/lustre/lustre/obdclass/class_obd.c |   3 -
 drivers/staging/lustre/lustre/obdclass/genops.c    |   8 -
 .../staging/lustre/lustre/obdecho/echo_client.c    |   6 +-
 drivers/staging/lustre/lustre/osc/osc_io.c         |   2 -
 drivers/staging/lustre/lustre/osc/osc_request.c    |  61 +-
 35 files changed, 114 insertions(+), 2152 deletions(-)
 delete mode 100644 drivers/staging/lustre/lustre/include/lustre_capa.h
 delete mode 100644 drivers/staging/lustre/lustre/llite/llite_capa.c
 delete mode 100644 drivers/staging/lustre/lustre/obdclass/capa.c

diff --git a/drivers/staging/lustre/lustre/include/cl_object.h b/drivers/staging/lustre/lustre/include/cl_object.h
index 90fbaa2..b2366ca 100644
--- a/drivers/staging/lustre/lustre/include/cl_object.h
+++ b/drivers/staging/lustre/lustre/include/cl_object.h
@@ -2335,7 +2335,6 @@ struct cl_io {
 		struct cl_setattr_io {
 			struct ost_lvb   sa_attr;
 			unsigned int     sa_valid;
-			struct obd_capa *sa_capa;
 		} ci_setattr;
 		struct cl_fault_io {
 			/** page index within file. */
@@ -2354,7 +2353,6 @@ struct cl_io {
 		struct cl_fsync_io {
 			loff_t	     fi_start;
 			loff_t	     fi_end;
-			struct obd_capa   *fi_capa;
 			/** file system level fid */
 			struct lu_fid     *fi_fid;
 			enum cl_fsync_mode fi_mode;
@@ -2473,8 +2471,6 @@ struct cl_io {
 struct cl_req_attr {
 	/** Generic attributes for the server consumption. */
 	struct obdo	*cra_oa;
-	/** Capability. */
-	struct obd_capa	*cra_capa;
 	/** Jobid */
 	char		 cra_jobid[JOBSTATS_JOBID_SIZE];
 };
diff --git a/drivers/staging/lustre/lustre/include/lclient.h b/drivers/staging/lustre/lustre/include/lclient.h
index c5c3a8d..67d41bb 100644
--- a/drivers/staging/lustre/lustre/include/lclient.h
+++ b/drivers/staging/lustre/lustre/include/lclient.h
@@ -371,8 +371,7 @@ struct page	 *cl2vm_page      (const struct cl_page_slice *slice);
 struct inode       *ccc_object_inode(const struct cl_object *obj);
 struct ccc_object  *cl_inode2ccc    (struct inode *inode);
 
-int cl_setattr_ost(struct inode *inode, const struct iattr *attr,
-		   struct obd_capa *capa);
+int cl_setattr_ost(struct inode *inode, const struct iattr *attr);
 
 struct cl_page *ccc_vmpage_page_transient(struct page *vmpage);
 int ccc_object_invariant(const struct cl_object *obj);
diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
index d20e199..057fa19 100644
--- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
+++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
@@ -3509,30 +3509,6 @@ enum {
 #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;
-}
-
-/* lustre_capa::lc_hmac_alg */
-enum {
-	CAPA_HMAC_ALG_SHA1 = 1, /**< sha1 algorithm */
-	CAPA_HMAC_ALG_MAX,
-};
-
-#define CAPA_FL_MASK	    0x00ffffff
-#define CAPA_HMAC_ALG_MASK      0xff000000
-
 struct lustre_capa_key {
 	__u64   lk_seq;       /**< mds# */
 	__u32   lk_keyid;     /**< key# */
diff --git a/drivers/staging/lustre/lustre/include/lustre_capa.h b/drivers/staging/lustre/lustre/include/lustre_capa.h
deleted file mode 100644
index 11bcdb9..0000000
--- a/drivers/staging/lustre/lustre/include/lustre_capa.h
+++ /dev/null
@@ -1,305 +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, 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@xxxxxxxxxxxxx>
- */
-
-#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 */
-	unsigned long		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 %llu 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)
-{
-	unsigned long expiry = cfs_time_sub((unsigned long)ocapa->c_capa.lc_expiry,
-					 get_seconds());
-	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 - get_seconds() <= 0);
-}
-
-static inline int capa_is_expired(struct obd_capa *ocapa)
-{
-	return time_before_eq(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_ID_NONE      = 0,
-	LC_ID_PLAIN     = 1,
-	LC_ID_CONVERT   = 2
-};
-
-#define BYPASS_CAPA (struct lustre_capa *)ERR_PTR(-ENOENT)
-
-/** @} capa */
-
-#endif /* __LINUX_CAPA_H_ */
diff --git a/drivers/staging/lustre/lustre/include/lustre_mds.h b/drivers/staging/lustre/lustre/include/lustre_mds.h
index f0cce41..a16eb8b 100644
--- a/drivers/staging/lustre/lustre/include/lustre_mds.h
+++ b/drivers/staging/lustre/lustre/include/lustre_mds.h
@@ -59,11 +59,6 @@ struct mds_group_info {
 	int group;
 };
 
-struct mds_capa_info {
-	struct obd_uuid	*uuid;
-	struct lustre_capa_key *capa;
-};
-
 #define MDD_OBD_NAME     "mdd_obd"
 #define MDD_OBD_UUID     "mdd_obd_uuid"
 
diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h
index 31cb97c..e8317b8 100644
--- a/drivers/staging/lustre/lustre/include/obd.h
+++ b/drivers/staging/lustre/lustre/include/obd.h
@@ -54,7 +54,6 @@
 #include "lustre_export.h"
 #include "lustre_fid.h"
 #include "lustre_fld.h"
-#include "lustre_capa.h"
 
 #define MAX_OBD_DEVICES 8192
 
@@ -162,9 +161,6 @@ struct obd_info {
 	 * request in osc level for enqueue requests. It is also possible to
 	 * update some caller data from LOV layer if needed. */
 	obd_enqueue_update_f    oi_cb_up;
-	/* oss capability, its type is obd_capa in client to avoid copy.
-	 * in contrary its type is lustre_capa in OSS. */
-	void		   *oi_capa;
 };
 
 void lov_stripe_lock(struct lov_stripe_md *md);
@@ -853,7 +849,6 @@ enum obd_cleanup_stage {
 #define KEY_ASYNC	       "async"
 #define KEY_BLOCKSIZE_BITS      "blocksize_bits"
 #define KEY_BLOCKSIZE	   "blocksize"
-#define KEY_CAPA_KEY	    "capa_key"
 #define KEY_CHANGELOG_CLEAR     "changelog_clear"
 #define KEY_FID2PATH	    "fid2path"
 #define KEY_CHECKSUM	    "checksum"
@@ -956,10 +951,6 @@ struct md_op_data {
 	__u64		   op_ioepoch;
 	__u32		   op_flags;
 
-	/* Capa fields */
-	struct obd_capa	*op_capa1;
-	struct obd_capa	*op_capa2;
-
 	/* Various operation flags. */
 	enum mds_op_bias        op_bias;
 
@@ -1060,14 +1051,12 @@ struct obd_ops {
 			  struct lov_stripe_md **mem_tgt,
 			  struct lov_mds_md *disk_src, int disk_len);
 	int (*o_preallocate)(struct lustre_handle *, u32 *req, u64 *ids);
-	/* FIXME: add fid capability support for create & destroy! */
 	int (*o_create)(const struct lu_env *env, struct obd_export *exp,
 			struct obdo *oa, struct lov_stripe_md **ea,
 			struct obd_trans_info *oti);
 	int (*o_destroy)(const struct lu_env *env, struct obd_export *exp,
 			 struct obdo *oa, struct lov_stripe_md *ea,
-			 struct obd_trans_info *oti, struct obd_export *md_exp,
-			 void *capa);
+			 struct obd_trans_info *oti, struct obd_export *md_exp);
 	int (*o_setattr)(const struct lu_env *, struct obd_export *exp,
 			 struct obd_info *oinfo, struct obd_trans_info *oti);
 	int (*o_setattr_async)(struct obd_export *exp, struct obd_info *oinfo,
@@ -1083,7 +1072,7 @@ struct obd_ops {
 			struct obd_export *exp, struct obdo *oa, int objcount,
 			struct obd_ioobj *obj, struct niobuf_remote *remote,
 			int *nr_pages, struct niobuf_local *local,
-			struct obd_trans_info *oti, struct lustre_capa *capa);
+			struct obd_trans_info *oti);
 	int (*o_commitrw)(const struct lu_env *env, int cmd,
 			  struct obd_export *exp, struct obdo *oa,
 			  int objcount, struct obd_ioobj *obj,
@@ -1151,8 +1140,6 @@ struct lustre_md {
 	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 {
@@ -1166,8 +1153,7 @@ struct md_open_data {
 struct lookup_intent;
 
 struct md_ops {
-	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 *,
 			     ldlm_iterator_t, void *);
@@ -1202,7 +1188,7 @@ struct md_ops {
 			 int, void *, int, struct ptlrpc_request **,
 			 struct md_open_data **mod);
 	int (*m_sync)(struct obd_export *, const struct lu_fid *,
-		      struct obd_capa *, struct ptlrpc_request **);
+		      struct ptlrpc_request **);
 	int (*m_readpage)(struct obd_export *, struct md_op_data *,
 			  struct page **, struct ptlrpc_request **);
 
@@ -1210,13 +1196,11 @@ struct md_ops {
 			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 obd_capa *, u64, const char *,
-			  const char *, int, int, int,
+			  u64, const char *, const char *, int, int, int,
 			  struct ptlrpc_request **);
 
 	int (*m_init_ea_size)(struct obd_export *, int, int, int, int);
@@ -1242,14 +1226,9 @@ struct md_ops {
 	int (*m_cancel_unused)(struct obd_export *, const struct lu_fid *,
 			       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 *,
-				 struct obd_capa *, __u32,
-				 struct ptlrpc_request **);
+				 __u32, struct ptlrpc_request **);
 
 	int (*m_intent_getattr_async)(struct obd_export *,
 				      struct md_enqueue_info *,
@@ -1298,11 +1277,6 @@ static inline const struct lsm_operations *lsm_op_find(int magic)
 #define OBD_CALC_STRIPE_START   1
 #define OBD_CALC_STRIPE_END     2
 
-static inline struct lustre_capa *oinfo_capa(struct obd_info *oinfo)
-{
-	return oinfo->oi_capa;
-}
-
 static inline struct md_open_data *obd_mod_alloc(void)
 {
 	struct md_open_data *mod;
diff --git a/drivers/staging/lustre/lustre/include/obd_class.h b/drivers/staging/lustre/lustre/include/obd_class.h
index 08ec2d0..8bfdc97 100644
--- a/drivers/staging/lustre/lustre/include/obd_class.h
+++ b/drivers/staging/lustre/lustre/include/obd_class.h
@@ -760,14 +760,14 @@ static inline int obd_create(const struct lu_env *env, struct obd_export *exp,
 static inline int obd_destroy(const struct lu_env *env, struct obd_export *exp,
 			      struct obdo *obdo, struct lov_stripe_md *ea,
 			      struct obd_trans_info *oti,
-			      struct obd_export *md_exp, void *capa)
+			      struct obd_export *md_exp)
 {
 	int rc;
 
 	EXP_CHECK_DT_OP(exp, destroy);
 	EXP_COUNTER_INCREMENT(exp, destroy);
 
-	rc = OBP(exp->exp_obd, destroy)(env, exp, obdo, ea, oti, md_exp, capa);
+	rc = OBP(exp->exp_obd, destroy)(env, exp, obdo, ea, oti, md_exp);
 	return rc;
 }
 
@@ -1168,8 +1168,7 @@ static inline int obd_preprw(const struct lu_env *env, int cmd,
 			     int objcount, struct obd_ioobj *obj,
 			     struct niobuf_remote *remote, int *pages,
 			     struct niobuf_local *local,
-			     struct obd_trans_info *oti,
-			     struct lustre_capa *capa)
+			     struct obd_trans_info *oti)
 {
 	int rc;
 
@@ -1177,7 +1176,7 @@ static inline int obd_preprw(const struct lu_env *env, int cmd,
 	EXP_COUNTER_INCREMENT(exp, preprw);
 
 	rc = OBP(exp->exp_obd, preprw)(env, cmd, exp, oa, objcount, obj, remote,
-				       pages, local, oti, capa);
+				       pages, local, oti);
 	return rc;
 }
 
@@ -1425,14 +1424,13 @@ static inline int obd_unregister_lock_cancel_cb(struct obd_export *exp,
 #endif
 
 /* 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;
 
 	EXP_CHECK_MD_OP(exp, getstatus);
 	EXP_MD_COUNTER_INCREMENT(exp, getstatus);
-	rc = MDP(exp->exp_obd, getstatus)(exp, fid, pc);
+	rc = MDP(exp->exp_obd, getstatus)(exp, fid);
 	return rc;
 }
 
@@ -1607,13 +1605,13 @@ static inline int md_setattr(struct obd_export *exp, struct md_op_data *op_data,
 }
 
 static inline int md_sync(struct obd_export *exp, const struct lu_fid *fid,
-			  struct obd_capa *oc, struct ptlrpc_request **request)
+			  struct ptlrpc_request **request)
 {
 	int rc;
 
 	EXP_CHECK_MD_OP(exp, sync);
 	EXP_MD_COUNTER_INCREMENT(exp, sync);
-	rc = MDP(exp->exp_obd, sync)(exp, fid, oc, request);
+	rc = MDP(exp->exp_obd, sync)(exp, fid, request);
 	return rc;
 }
 
@@ -1659,8 +1657,7 @@ static inline int md_free_lustre_md(struct obd_export *exp,
 	return MDP(exp->exp_obd, free_lustre_md)(exp, md);
 }
 
-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,
@@ -1668,13 +1665,12 @@ static inline int md_setxattr(struct obd_export *exp,
 {
 	EXP_CHECK_MD_OP(exp, setxattr);
 	EXP_MD_COUNTER_INCREMENT(exp, setxattr);
-	return MDP(exp->exp_obd, setxattr)(exp, fid, oc, valid, name, input,
+	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,
@@ -1682,7 +1678,7 @@ static inline int md_getxattr(struct obd_export *exp,
 {
 	EXP_CHECK_MD_OP(exp, getxattr);
 	EXP_MD_COUNTER_INCREMENT(exp, getxattr);
-	return MDP(exp->exp_obd, getxattr)(exp, fid, oc, valid, name, input,
+	return MDP(exp->exp_obd, getxattr)(exp, fid, valid, name, input,
 					   input_size, output_size, flags,
 					   request);
 }
@@ -1753,40 +1749,15 @@ static inline int md_init_ea_size(struct obd_export *exp, int easize,
 }
 
 static inline int md_get_remote_perm(struct obd_export *exp,
-				     const struct lu_fid *fid,
-				     struct obd_capa *oc, __u32 suppgid,
+				     const struct lu_fid *fid, __u32 suppgid,
 				     struct ptlrpc_request **request)
 {
 	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,
+	return MDP(exp->exp_obd, get_remote_perm)(exp, fid, suppgid,
 						  request);
 }
 
-static inline int md_renew_capa(struct obd_export *exp, struct obd_capa *ocapa,
-				renew_capa_cb_t cb)
-{
-	int rc;
-
-	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;
-}
-
-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;
-
-	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;
-}
-
 static inline int md_intent_getattr_async(struct obd_export *exp,
 					  struct md_enqueue_info *minfo,
 					  struct ldlm_enqueue_info *einfo)
diff --git a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
index 9053f81..f049d55 100644
--- a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
+++ b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
@@ -896,7 +896,6 @@ void ccc_req_completion(const struct lu_env *env,
  *
  *    - o_ioepoch,
  *
- *  and capability.
  */
 void ccc_req_attr_set(const struct lu_env *env,
 		      const struct cl_req_slice *slice,
@@ -911,12 +910,6 @@ void ccc_req_attr_set(const struct lu_env *env,
 	inode = ccc_object_inode(obj);
 	valid_flags = OBD_MD_FLTYPE;
 
-	if ((flags & OBD_MD_FLOSSCAPA) != 0) {
-		LASSERT(attr->cra_capa == NULL);
-		attr->cra_capa = cl_capa_lookup(inode,
-						slice->crs_req->crq_type);
-	}
-
 	if (slice->crs_req->crq_type == CRT_WRITE) {
 		if (flags & OBD_MD_FLEPOCH) {
 			oa->o_valid |= OBD_MD_FLEPOCH;
@@ -936,8 +929,7 @@ static const struct cl_req_operations ccc_req_ops = {
 	.cro_completion = ccc_req_completion
 };
 
-int cl_setattr_ost(struct inode *inode, const struct iattr *attr,
-		   struct obd_capa *capa)
+int cl_setattr_ost(struct inode *inode, const struct iattr *attr)
 {
 	struct lu_env *env;
 	struct cl_io  *io;
@@ -956,7 +948,6 @@ int cl_setattr_ost(struct inode *inode, const struct iattr *attr,
 	io->u.ci_setattr.sa_attr.lvb_ctime = LTIME_S(attr->ia_ctime);
 	io->u.ci_setattr.sa_attr.lvb_size = attr->ia_size;
 	io->u.ci_setattr.sa_valid = attr->ia_valid;
-	io->u.ci_setattr.sa_capa = capa;
 
 again:
 	if (cl_io_init(env, io, CIT_SETATTR, io->ci_obj) == 0) {
diff --git a/drivers/staging/lustre/lustre/llite/Makefile b/drivers/staging/lustre/lustre/llite/Makefile
index 2cbc468..9ac29e7 100644
--- a/drivers/staging/lustre/lustre/llite/Makefile
+++ b/drivers/staging/lustre/lustre/llite/Makefile
@@ -2,7 +2,7 @@ obj-$(CONFIG_LUSTRE_FS) += lustre.o
 obj-$(CONFIG_LUSTRE_LLITE_LLOOP) += llite_lloop.o
 lustre-y := dcache.o dir.o file.o llite_close.o llite_lib.o llite_nfs.o \
 	    rw.o namei.o symlink.o llite_mmap.o \
-	    xattr.o xattr_cache.o remote_perm.o llite_rmtacl.o llite_capa.o \
+	    xattr.o xattr_cache.o remote_perm.o llite_rmtacl.o \
 	    rw26.o super25.o statahead.o \
 	    ../lclient/glimpse.o ../lclient/lcommon_cl.o ../lclient/lcommon_misc.o \
 	    vvp_dev.o vvp_page.o vvp_lock.o vvp_io.o vvp_object.o lproc_llite.o
diff --git a/drivers/staging/lustre/lustre/llite/file.c b/drivers/staging/lustre/lustre/llite/file.c
index 5627c0f..51b6bc5 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -92,7 +92,6 @@ void ll_pack_inode2opdata(struct inode *inode, struct md_op_data *op_data,
 	op_data->op_ioepoch = ll_i2info(inode)->lli_ioepoch;
 	if (fh)
 		op_data->op_handle = *fh;
-	op_data->op_capa1 = ll_mdscapa_get(inode);
 
 	if (ll_i2info(inode)->lli_flags & LLIF_DATA_MODIFIED)
 		op_data->op_bias |= MDS_DATA_MODIFIED;
@@ -321,7 +320,6 @@ static int ll_md_close(struct obd_export *md_exp, struct inode *inode,
 out:
 	LUSTRE_FPRIVATE(file) = NULL;
 	ll_file_data_put(fd);
-	ll_capa_close(inode);
 
 	return rc;
 }
@@ -679,8 +677,6 @@ restart:
 	if (!S_ISREG(inode->i_mode))
 		goto out_och_free;
 
-	ll_capa_open(inode);
-
 	if (!lli->lli_has_smd &&
 	    (cl_is_lov_delay_create(file->f_flags) ||
 	     (file->f_mode & FMODE_WRITE) == 0)) {
@@ -912,8 +908,7 @@ static int ll_lease_close(struct obd_client_handle *och, struct inode *inode,
 
 /* Fills the obdo with the attributes for the lsm */
 static int ll_lsm_getattr(struct lov_stripe_md *lsm, struct obd_export *exp,
-			  struct obd_capa *capa, struct obdo *obdo,
-			  __u64 ioepoch, int sync)
+			  struct obdo *obdo, __u64 ioepoch, int sync)
 {
 	struct ptlrpc_request_set *set;
 	struct obd_info	    oinfo = { };
@@ -932,7 +927,6 @@ static int ll_lsm_getattr(struct lov_stripe_md *lsm, struct obd_export *exp,
 			       OBD_MD_FLMTIME | OBD_MD_FLCTIME |
 			       OBD_MD_FLGROUP | OBD_MD_FLEPOCH |
 			       OBD_MD_FLDATAVERSION;
-	oinfo.oi_capa = capa;
 	if (sync) {
 		oinfo.oi_oa->o_valid |= OBD_MD_FLFLAGS;
 		oinfo.oi_oa->o_flags |= OBD_FL_SRVLOCK;
@@ -963,14 +957,12 @@ static int ll_lsm_getattr(struct lov_stripe_md *lsm, struct obd_export *exp,
 int ll_inode_getattr(struct inode *inode, struct obdo *obdo,
 		     __u64 ioepoch, int sync)
 {
-	struct obd_capa      *capa = ll_mdscapa_get(inode);
 	struct lov_stripe_md *lsm;
 	int rc;
 
 	lsm = ccc_inode_lsm_get(inode);
 	rc = ll_lsm_getattr(lsm, ll_i2dtexp(inode),
-			    capa, obdo, ioepoch, sync);
-	capa_put(capa);
+			    obdo, ioepoch, sync);
 	if (rc == 0) {
 		struct ost_id *oi = lsm ? &lsm->lsm_oi : &obdo->o_oi;
 
@@ -1038,7 +1030,7 @@ int ll_glimpse_ioctl(struct ll_sb_info *sbi, struct lov_stripe_md *lsm,
 	struct obdo obdo = { 0 };
 	int rc;
 
-	rc = ll_lsm_getattr(lsm, sbi->ll_dt_exp, NULL, &obdo, 0, 0);
+	rc = ll_lsm_getattr(lsm, sbi->ll_dt_exp, &obdo, 0, 0);
 	if (rc == 0) {
 		st->st_size   = obdo.o_size;
 		st->st_blocks = obdo.o_blocks;
@@ -1874,7 +1866,7 @@ int ll_data_version(struct inode *inode, __u64 *data_version,
 		goto out;
 	}
 
-	rc = ll_lsm_getattr(lsm, sbi->ll_dt_exp, NULL, obdo, 0, extent_lock);
+	rc = ll_lsm_getattr(lsm, sbi->ll_dt_exp, obdo, 0, extent_lock);
 	if (rc == 0) {
 		if (!(obdo->o_valid & OBD_MD_FLDATAVERSION))
 			rc = -EOPNOTSUPP;
@@ -2574,7 +2566,6 @@ int cl_sync_file_range(struct inode *inode, loff_t start, loff_t end,
 	struct cl_env_nest nest;
 	struct lu_env *env;
 	struct cl_io *io;
-	struct obd_capa *capa = NULL;
 	struct cl_fsync_io *fio;
 	int result;
 
@@ -2586,15 +2577,12 @@ int cl_sync_file_range(struct inode *inode, loff_t start, loff_t end,
 	if (IS_ERR(env))
 		return PTR_ERR(env);
 
-	capa = ll_osscapa_get(inode, CAPA_OPC_OSS_WRITE);
-
 	io = ccc_env_thread_io(env);
 	io->ci_obj = cl_i2info(inode)->lli_clob;
 	io->ci_ignore_layout = ignore_layout;
 
 	/* initialize parameters for sync */
 	fio = &io->u.ci_fsync;
-	fio->fi_capa = capa;
 	fio->fi_start = start;
 	fio->fi_end = end;
 	fio->fi_fid = ll_inode2fid(inode);
@@ -2610,8 +2598,6 @@ int cl_sync_file_range(struct inode *inode, loff_t start, loff_t end,
 	cl_io_fini(env, io);
 	cl_env_nested_put(&nest, env);
 
-	capa_put(capa);
-
 	return result;
 }
 
@@ -2620,7 +2606,6 @@ int ll_fsync(struct file *file, loff_t start, loff_t end, int datasync)
 	struct inode *inode = file_inode(file);
 	struct ll_inode_info *lli = ll_i2info(inode);
 	struct ptlrpc_request *req;
-	struct obd_capa *oc;
 	int rc, err;
 
 	CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p)\n", inode->i_ino,
@@ -2642,10 +2627,7 @@ int ll_fsync(struct file *file, loff_t start, loff_t end, int datasync)
 			rc = err;
 	}
 
-	oc = ll_mdscapa_get(inode);
-	err = md_sync(ll_i2sbi(inode)->ll_md_exp, ll_inode2fid(inode), oc,
-		      &req);
-	capa_put(oc);
+	err = md_sync(ll_i2sbi(inode)->ll_md_exp, ll_inode2fid(inode), &req);
 	if (!rc)
 		rc = err;
 	if (!err)
@@ -2963,9 +2945,6 @@ static int __ll_inode_revalidate(struct dentry *dentry, __u64 ibits)
 			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) {
@@ -3316,7 +3295,6 @@ static int ll_layout_fetch(struct inode *inode, struct ldlm_lock *lock)
 
 {
 	struct ll_sb_info *sbi = ll_i2sbi(inode);
-	struct obd_capa *oc;
 	struct ptlrpc_request *req;
 	struct mdt_body *body;
 	void *lvbdata;
@@ -3336,13 +3314,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 */
-	oc = ll_mdscapa_get(inode);
 	rc = ll_get_default_mdsize(sbi, &lmmsize);
 	if (rc == 0)
-		rc = md_getxattr(sbi->ll_md_exp, ll_inode2fid(inode), oc,
-				OBD_MD_FLXATTR, XATTR_NAME_LOV, NULL, 0,
-				lmmsize, 0, &req);
-	capa_put(oc);
+		rc = md_getxattr(sbi->ll_md_exp, ll_inode2fid(inode),
+				 OBD_MD_FLXATTR, XATTR_NAME_LOV, NULL, 0,
+				 lmmsize, 0, &req);
 	if (rc < 0)
 		return rc;
 
diff --git a/drivers/staging/lustre/lustre/llite/llite_capa.c b/drivers/staging/lustre/lustre/llite/llite_capa.c
deleted file mode 100644
index 24590ae..0000000
--- a/drivers/staging/lustre/lustre/llite/llite_capa.c
+++ /dev/null
@@ -1,661 +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) 2011, 2012, 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@xxxxxxxxxxxxx>
- */
-
-#define DEBUG_SUBSYSTEM S_LLITE
-
-#include <linux/fs.h>
-#include <linux/uaccess.h>
-#include <linux/file.h>
-#include <linux/kmod.h>
-
-#include "../include/lustre_lite.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 LIST_HEAD(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;
-static unsigned long long ll_capa_renewal_noent;
-static unsigned long long ll_capa_renewal_failed;
-static unsigned long long ll_capa_renewal_retries;
-
-static int ll_update_capa(struct obd_capa *ocapa, struct lustre_capa *capa);
-
-static inline void update_capa_timer(struct obd_capa *ocapa,
-				     unsigned long expiry)
-{
-	if (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 unsigned long 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 time_before_eq(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;
-
-	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) {
-				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;
-
-	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_osscapa_get(struct inode *inode, __u64 opc)
-{
-	struct ll_inode_info *lli = ll_i2info(inode);
-	struct obd_capa *ocapa;
-	int found = 0;
-
-	if ((ll_i2sbi(inode)->ll_flags & LL_SBI_OSS_CAPA) == 0)
-		return NULL;
-
-	LASSERT(opc == CAPA_OPC_OSS_WRITE || opc == CAPA_OPC_OSS_RW ||
-		opc == CAPA_OPC_OSS_TRUNC);
-
-	spin_lock(&capa_lock);
-	list_for_each_entry(ocapa, &lli->lli_oss_capas, u.cli.lli_list) {
-		if (capa_is_expired(ocapa))
-			continue;
-		if ((opc & CAPA_OPC_OSS_WRITE) &&
-		    capa_opc_supported(&ocapa->c_capa, CAPA_OPC_OSS_WRITE)) {
-			found = 1;
-			break;
-		} else if ((opc & CAPA_OPC_OSS_READ) &&
-			   capa_opc_supported(&ocapa->c_capa,
-					      CAPA_OPC_OSS_READ)) {
-			found = 1;
-			break;
-		} else if ((opc & CAPA_OPC_OSS_TRUNC) &&
-			   capa_opc_supported(&ocapa->c_capa, opc)) {
-			found = 1;
-			break;
-		}
-	}
-
-	if (found) {
-		LASSERT(lu_fid_eq(capa_fid(&ocapa->c_capa),
-				  ll_inode2fid(inode)));
-		LASSERT(ocapa->c_site == CAPA_SITE_CLIENT);
-
-		capa_get(ocapa);
-
-		DEBUG_CAPA(D_SEC, &ocapa->c_capa, "found client");
-	} else {
-		ocapa = NULL;
-
-		if (atomic_read(&ll_capa_debug)) {
-			CERROR("no capability for " DFID " opc %#llx\n",
-			       PFID(&lli->lli_fid), opc);
-			atomic_set(&ll_capa_debug, 0);
-		}
-	}
-	spin_unlock(&capa_lock);
-
-	return ocapa;
-}
-EXPORT_SYMBOL(ll_osscapa_get);
-
-struct obd_capa *ll_mdscapa_get(struct inode *inode)
-{
-	struct ll_inode_info *lli = ll_i2info(inode);
-	struct obd_capa *ocapa;
-
-	LASSERT(inode);
-
-	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, unsigned long 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;
-
-	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;
-			} 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");
-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);
-}
diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h
index fdd0a58..dcf7c6b 100644
--- a/drivers/staging/lustre/lustre/llite/llite_internal.h
+++ b/drivers/staging/lustre/lustre/llite/llite_internal.h
@@ -134,11 +134,9 @@ struct ll_inode_info {
 	struct lu_fid		   lli_pfid;
 
 	struct list_head		      lli_close_list;
-	struct list_head		      lli_oss_capas;
 	/* open count currently used by capability only, indicate whether
 	 * capability needs renewal */
 	atomic_t		    lli_open_count;
-	struct obd_capa		*lli_mds_capa;
 	unsigned long		      lli_rmtperm_time;
 
 	/* handle is to be sent to MDS later on done_writing and setattr.
@@ -398,8 +396,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_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 */
@@ -1053,25 +1051,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);
 
-/* 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);
-struct obd_capa *ll_osscapa_get(struct inode *inode, __u64 opc);
-
-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);
-
 /* llite/llite_cl.c */
 extern struct lu_device_type vvp_device_type;
 
@@ -1345,8 +1324,6 @@ static inline int cl_merge_lvb(const struct lu_env *env, struct inode *inode)
 #define cl_inode_ctime(inode) LTIME_S((inode)->i_ctime)
 #define cl_inode_mtime(inode) LTIME_S((inode)->i_mtime)
 
-struct obd_capa *cl_capa_lookup(struct inode *inode, enum cl_req_type crt);
-
 int cl_sync_file_range(struct inode *inode, loff_t start, loff_t end,
 		       enum cl_fsync_mode mode, int ignore_layout);
 
diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c
index a0ae892..b6234b2 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -146,7 +146,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 obd_capa *oc = NULL;
 	struct obd_statfs *osfs = NULL;
 	struct ptlrpc_request *request = NULL;
 	struct obd_connect_data *data = NULL;
@@ -182,7 +181,6 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
 	data->ocd_connect_flags = OBD_CONNECT_IBITS    | OBD_CONNECT_NODEVOH  |
 				  OBD_CONNECT_ATTRFID  |
 				  OBD_CONNECT_VERSION  | OBD_CONNECT_BRW_SIZE |
-				  OBD_CONNECT_MDS_CAPA | OBD_CONNECT_OSS_CAPA |
 				  OBD_CONNECT_CANCELSET | OBD_CONNECT_FID     |
 				  OBD_CONNECT_AT       | OBD_CONNECT_LOV_V3   |
 				  OBD_CONNECT_RMT_CLIENT | OBD_CONNECT_VBR    |
@@ -334,16 +332,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;
 
@@ -445,7 +433,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);
-	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;
@@ -466,7 +454,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? */
-	valid = OBD_MD_FLGETATTR | OBD_MD_FLBLOCKS | OBD_MD_FLMDSCAPA;
+	valid = OBD_MD_FLGETATTR | OBD_MD_FLBLOCKS;
 	if (sbi->ll_flags & LL_SBI_RMT_CLIENT)
 		valid |= OBD_MD_FLRMTPERM;
 	else if (sbi->ll_flags & LL_SBI_ACL)
@@ -480,12 +468,9 @@ 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_capa1 = oc;
 	op_data->op_valid = valid;
 
 	err = md_getattr(sbi->ll_md_exp, op_data, &request);
-	if (oc)
-		capa_put(oc);
 	kfree(op_data);
 	if (err) {
 		CERROR("%s: md_getattr failed for root: rc = %d\n",
@@ -838,9 +823,7 @@ void ll_lli_init(struct ll_inode_info *lli)
 	/* Do not set lli_fid, it has been initialized already. */
 	fid_zero(&lli->lli_pfid);
 	INIT_LIST_HEAD(&lli->lli_close_list);
-	INIT_LIST_HEAD(&lli->lli_oss_capas);
 	atomic_set(&lli->lli_open_count, 0);
-	lli->lli_mds_capa = NULL;
 	lli->lli_rmtperm_time = 0;
 	lli->lli_pending_och = NULL;
 	lli->lli_mds_read_och = NULL;
@@ -994,8 +977,6 @@ void ll_put_super(struct super_block *sb)
 
 	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);
 
@@ -1126,7 +1107,6 @@ void ll_clear_inode(struct inode *inode)
 #endif
 	lli->lli_inode_magic = LLI_INODE_DEAD;
 
-	ll_clear_inode_capas(inode);
 	if (!S_ISDIR(inode->i_mode))
 		LASSERT(list_empty(&lli->lli_agl_list));
 
@@ -1183,7 +1163,7 @@ static int ll_md_setattr(struct dentry *dentry, struct md_op_data *op_data,
 	}
 
 	ia_valid = op_data->op_attr.ia_valid;
-	/* inode size will be in ll_setattr_ost, can't do it now since dirty
+	/* inode size will be in cl_setattr_ost, can't do it now since dirty
 	 * cache is not cleared yet. */
 	op_data->op_attr.ia_valid &= ~(TIMES_SET_FLAGS | ATTR_SIZE);
 	rc = simple_setattr(dentry, &op_data->op_attr);
@@ -1229,27 +1209,6 @@ static int ll_setattr_done_writing(struct inode *inode,
 	return rc;
 }
 
-static int ll_setattr_ost(struct inode *inode, struct iattr *attr)
-{
-	struct obd_capa *capa;
-	int rc;
-
-	if (attr->ia_valid & ATTR_SIZE)
-		capa = ll_osscapa_get(inode, CAPA_OPC_OSS_TRUNC);
-	else
-		capa = ll_mdscapa_get(inode);
-
-	rc = cl_setattr_ost(inode, attr, capa);
-
-	if (attr->ia_valid & ATTR_SIZE)
-		ll_truncate_free_capa(capa);
-	else
-		capa_put(capa);
-
-	return rc;
-}
-
-
 /* If this inode has objects allocated to it (lsm != NULL), then the OST
  * object(s) determine the file size and mtime.  Otherwise, the MDS will
  * keep these values until such a time that objects are allocated for it.
@@ -1412,7 +1371,7 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, bool hsm_import)
 		 * time de-synchronization between MDT inode and OST objects */
 		if (attr->ia_valid & ATTR_SIZE)
 			down_write(&lli->lli_trunc_sem);
-		rc = ll_setattr_ost(inode, attr);
+		rc = cl_setattr_ost(inode, attr);
 		if (attr->ia_valid & ATTR_SIZE)
 			up_write(&lli->lli_trunc_sem);
 	}
@@ -1705,15 +1664,6 @@ void ll_update_inode(struct inode *inode, struct lustre_md *md)
 			inode->i_blocks = body->blocks;
 	}
 
-	if (body->valid & OBD_MD_FLMDSCAPA) {
-		LASSERT(md->mds_capa);
-		ll_add_capa(inode, md->mds_capa);
-	}
-	if (body->valid & OBD_MD_FLOSSCAPA) {
-		LASSERT(md->oss_capa);
-		ll_add_capa(inode, md->oss_capa);
-	}
-
 	if (body->valid & OBD_MD_TSTATE) {
 		if (body->t_state & MS_RESTORE)
 			lli->lli_flags |= LLIF_FILE_RESTORING;
@@ -1862,10 +1812,8 @@ int ll_iocontrol(struct inode *inode, struct file *file,
 		oinfo.oi_oa->o_flags = flags;
 		oinfo.oi_oa->o_valid = OBD_MD_FLID | OBD_MD_FLFLAGS |
 				       OBD_MD_FLGROUP;
-		oinfo.oi_capa = ll_mdscapa_get(inode);
 		obdo_set_parent_fid(oinfo.oi_oa, &ll_i2info(inode)->lli_fid);
 		rc = obd_setattr_rqset(sbi->ll_dt_exp, &oinfo, NULL);
-		capa_put(oinfo.oi_capa);
 		OBDO_FREE(oinfo.oi_oa);
 		ccc_inode_lsm_put(inode, lsm);
 
@@ -2205,15 +2153,11 @@ 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);
-	op_data->op_capa1 = ll_mdscapa_get(i1);
 
-	if (i2) {
+	if (i2)
 		op_data->op_fid2 = *ll_inode2fid(i2);
-		op_data->op_capa2 = ll_mdscapa_get(i2);
-	} else {
+	else
 		fid_zero(&op_data->op_fid2);
-		op_data->op_capa2 = NULL;
-	}
 
 	op_data->op_name = name;
 	op_data->op_namelen = namelen;
@@ -2242,7 +2186,6 @@ struct md_op_data *ll_prep_md_op_data(struct md_op_data *op_data,
 		if (likely(!lli->lli_has_smd && !fid_is_zero(&lli->lli_pfid)))
 			op_data->op_fid1 = lli->lli_pfid;
 		spin_unlock(&lli->lli_lock);
-		/** We ignore parent's capability temporary. */
 	}
 
 	/* When called by ll_setattr_raw, file is i1. */
@@ -2254,8 +2197,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)
 {
-	capa_put(op_data->op_capa1);
-	capa_put(op_data->op_capa2);
 	kfree(op_data);
 }
 
diff --git a/drivers/staging/lustre/lustre/llite/namei.c b/drivers/staging/lustre/lustre/llite/namei.c
index 2635678..2e663ea 100644
--- a/drivers/staging/lustre/lustre/llite/namei.c
+++ b/drivers/staging/lustre/lustre/llite/namei.c
@@ -905,7 +905,6 @@ int ll_objects_destroy(struct ptlrpc_request *request, struct inode *dir)
 	struct lov_stripe_md *lsm = NULL;
 	struct obd_trans_info oti = { 0 };
 	struct obdo *oa;
-	struct obd_capa *oc = NULL;
 	int rc;
 
 	/* req is swabbed so this is safe */
@@ -957,15 +956,8 @@ int ll_objects_destroy(struct ptlrpc_request *request, struct inode *dir)
 		}
 	}
 
-	if (body->valid & OBD_MD_FLOSSCAPA) {
-		rc = md_unpack_capa(ll_i2mdexp(dir), request, &RMF_CAPA2, &oc);
-		if (rc)
-			goto out_free_memmd;
-	}
-
 	rc = obd_destroy(NULL, ll_i2dtexp(dir), oa, lsm, &oti,
-			 ll_i2mdexp(dir), oc);
-	capa_put(oc);
+			 ll_i2mdexp(dir));
 	if (rc)
 		CERROR("obd destroy objid "DOSTID" error %d\n",
 		       POSTID(&lsm->lsm_oi), rc);
diff --git a/drivers/staging/lustre/lustre/llite/remote_perm.c b/drivers/staging/lustre/lustre/llite/remote_perm.c
index 39022ea..dc33055 100644
--- a/drivers/staging/lustre/lustre/llite/remote_perm.c
+++ b/drivers/staging/lustre/lustre/llite/remote_perm.c
@@ -249,7 +249,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 obd_capa *oc;
 	unsigned long save;
 	int i = 0, rc;
 
@@ -276,10 +275,8 @@ int lustre_check_remote_perm(struct inode *inode, int mask)
 			LBUG();
 		}
 
-		oc = ll_mdscapa_get(inode);
-		rc = md_get_remote_perm(sbi->ll_md_exp, ll_inode2fid(inode), oc,
+		rc = md_get_remote_perm(sbi->ll_md_exp, ll_inode2fid(inode),
 					ll_i2suppgid(inode), &req);
-		capa_put(oc);
 		if (rc) {
 			mutex_unlock(&lli->lli_rmtperm_mutex);
 			break;
diff --git a/drivers/staging/lustre/lustre/llite/rw.c b/drivers/staging/lustre/lustre/llite/rw.c
index 3e28255..8c1bfd2 100644
--- a/drivers/staging/lustre/lustre/llite/rw.c
+++ b/drivers/staging/lustre/lustre/llite/rw.c
@@ -277,14 +277,6 @@ int ll_commit_write(struct file *file, struct page *vmpage, unsigned from,
 	return result;
 }
 
-struct obd_capa *cl_capa_lookup(struct inode *inode, enum cl_req_type crt)
-{
-	__u64 opc;
-
-	opc = crt == CRT_WRITE ? CAPA_OPC_OSS_WRITE : CAPA_OPC_OSS_RW;
-	return ll_osscapa_get(inode, opc);
-}
-
 static void ll_ra_stats_inc_sbi(struct ll_sb_info *sbi, enum ra_stat which);
 
 /**
diff --git a/drivers/staging/lustre/lustre/llite/statahead.c b/drivers/staging/lustre/lustre/llite/statahead.c
index 8f4cca1..c860281 100644
--- a/drivers/staging/lustre/lustre/llite/statahead.c
+++ b/drivers/staging/lustre/lustre/llite/statahead.c
@@ -784,25 +784,16 @@ static void sa_args_fini(struct md_enqueue_info *minfo,
 {
 	LASSERT(minfo && einfo);
 	iput(minfo->mi_dir);
-	capa_put(minfo->mi_data.op_capa1);
-	capa_put(minfo->mi_data.op_capa2);
 	kfree(minfo);
 	kfree(einfo);
 }
 
 /**
- * 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".
+ * prepare arguments for async stat RPC.
  */
 static int sa_args_init(struct inode *dir, struct inode *child,
 			struct ll_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 ll_inode_info     *lli  = ll_i2info(dir);
@@ -843,8 +834,6 @@ static int sa_args_init(struct inode *dir, struct inode *child,
 
 	*pmi = minfo;
 	*pei = einfo;
-	pcapa[0] = op_data->op_capa1;
-	pcapa[1] = op_data->op_capa2;
 
 	return 0;
 }
@@ -853,20 +842,15 @@ static int do_sa_lookup(struct inode *dir, struct ll_sa_entry *entry)
 {
 	struct md_enqueue_info   *minfo;
 	struct ldlm_enqueue_info *einfo;
-	struct obd_capa	  *capas[2];
 	int		       rc;
 
-	rc = sa_args_init(dir, NULL, entry, &minfo, &einfo, capas);
+	rc = sa_args_init(dir, NULL, entry, &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_args_fini(minfo, einfo);
-	}
 
 	return rc;
 }
@@ -885,7 +869,6 @@ static int do_sa_revalidate(struct inode *dir, struct ll_sa_entry *entry,
 					 .d.lustre.it_lock_handle = 0 };
 	struct md_enqueue_info   *minfo;
 	struct ldlm_enqueue_info *einfo;
-	struct obd_capa	  *capas[2];
 	int rc;
 
 	if (unlikely(inode == NULL))
@@ -903,7 +886,7 @@ static int do_sa_revalidate(struct inode *dir, struct ll_sa_entry *entry,
 		return 1;
 	}
 
-	rc = sa_args_init(dir, inode, entry, &minfo, &einfo, capas);
+	rc = sa_args_init(dir, inode, entry, &minfo, &einfo);
 	if (rc) {
 		entry->se_inode = NULL;
 		iput(inode);
@@ -911,10 +894,7 @@ static int do_sa_revalidate(struct inode *dir, struct ll_sa_entry *entry,
 	}
 
 	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_args_fini(minfo, einfo);
diff --git a/drivers/staging/lustre/lustre/llite/super25.c b/drivers/staging/lustre/lustre/llite/super25.c
index a0de99f..b35e02a 100644
--- a/drivers/staging/lustre/lustre/llite/super25.c
+++ b/drivers/staging/lustre/lustre/llite/super25.c
@@ -154,14 +154,10 @@ static int __init init_lustre_lite(void)
 
 	ktime_get_ts64(&ts);
 	cfs_srand(ts.tv_sec ^ seed[0], ts.tv_nsec ^ seed[1]);
-	setup_timer(&ll_capa_timer, ll_capa_timer_callback, 0);
-	rc = ll_capa_thread_start();
-	if (rc != 0)
-		goto out_sysfs;
 
 	rc = vvp_global_init();
 	if (rc != 0)
-		goto out_capa;
+		goto out_sysfs;
 
 	rc = ll_xattr_init();
 	if (rc != 0)
@@ -175,9 +171,6 @@ static int __init init_lustre_lite(void)
 
 out_vvp:
 	vvp_global_fini();
-out_capa:
-	del_timer(&ll_capa_timer);
-	ll_capa_thread_stop();
 out_sysfs:
 	kset_unregister(llite_kset);
 out_debugfs:
@@ -201,11 +194,6 @@ static void __exit exit_lustre_lite(void)
 
 	ll_xattr_fini();
 	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);
diff --git a/drivers/staging/lustre/lustre/llite/xattr.c b/drivers/staging/lustre/lustre/llite/xattr.c
index 362a87d..db27c00 100644
--- a/drivers/staging/lustre/lustre/llite/xattr.c
+++ b/drivers/staging/lustre/lustre/llite/xattr.c
@@ -111,7 +111,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 obd_capa *oc;
 #ifdef CONFIG_FS_POSIX_ACL
 	struct rmtacl_ctl_entry *rce = NULL;
 	posix_acl_xattr_header *new_value = NULL;
@@ -188,11 +187,9 @@ int ll_setxattr_common(struct inode *inode, const char *name,
 		valid |= rce_ops2valid(rce->rce_ops);
 	}
 #endif
-	oc = ll_mdscapa_get(inode);
-	rc = md_setxattr(sbi->ll_md_exp, ll_inode2fid(inode), oc,
+	rc = md_setxattr(sbi->ll_md_exp, ll_inode2fid(inode),
 			 valid, name, pv, size, 0, flags,
 			 ll_i2suppgid(inode), &req);
-	capa_put(oc);
 #ifdef CONFIG_FS_POSIX_ACL
 	if (new_value != NULL)
 		lustre_posix_acl_xattr_free(new_value, size);
@@ -289,7 +286,6 @@ int ll_getxattr_common(struct inode *inode, const char *name,
 	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);
 
@@ -380,11 +376,9 @@ do_getxattr:
 		}
 	} 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);
-		capa_put(oc);
 
 		if (rc < 0)
 			goto out_xattr;
diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
index cebbacf..8f0ffa4 100644
--- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c
+++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
@@ -1438,8 +1438,7 @@ out_free_temp:
 }
 
 static int lmv_getstatus(struct obd_export *exp,
-			 struct lu_fid *fid,
-			 struct obd_capa **pc)
+			 struct lu_fid *fid)
 {
 	struct obd_device    *obd = exp->exp_obd;
 	struct lmv_obd       *lmv = &obd->u.lmv;
@@ -1449,12 +1448,12 @@ static int lmv_getstatus(struct obd_export *exp,
 	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,
-			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)
 {
@@ -1471,14 +1470,14 @@ static int lmv_getxattr(struct obd_export *exp, const struct lu_fid *fid,
 	if (IS_ERR(tgt))
 		return PTR_ERR(tgt);
 
-	rc = md_getxattr(tgt->ltd_exp, fid, oc, valid, name, input,
+	rc = md_getxattr(tgt->ltd_exp, fid, valid, name, input,
 			 input_size, output_size, flags, request);
 
 	return rc;
 }
 
 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)
@@ -1496,7 +1495,7 @@ static int lmv_setxattr(struct obd_export *exp, const struct lu_fid *fid,
 	if (IS_ERR(tgt))
 		return PTR_ERR(tgt);
 
-	rc = md_setxattr(tgt->ltd_exp, fid, oc, valid, name, input,
+	rc = md_setxattr(tgt->ltd_exp, fid, valid, name, input,
 			 input_size, output_size, flags, suppgid,
 			 request);
 
@@ -2014,7 +2013,7 @@ static int lmv_setattr(struct obd_export *exp, struct md_op_data *op_data,
 }
 
 static int lmv_sync(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;
@@ -2029,7 +2028,7 @@ static int lmv_sync(struct obd_export *exp, const struct lu_fid *fid,
 	if (IS_ERR(tgt))
 		return PTR_ERR(tgt);
 
-	rc = md_sync(tgt->ltd_exp, fid, oc, request);
+	rc = md_sync(tgt->ltd_exp, fid, request);
 	return rc;
 }
 
@@ -2607,8 +2606,7 @@ static int lmv_clear_open_replay_data(struct obd_export *exp,
 
 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)
+			       __u32 suppgid, struct ptlrpc_request **request)
 {
 	struct obd_device       *obd = exp->exp_obd;
 	struct lmv_obd	  *lmv = &obd->u.lmv;
@@ -2623,39 +2621,10 @@ static int lmv_get_remote_perm(struct obd_export *exp,
 	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;
-
-	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);
+	rc = md_get_remote_perm(tgt->ltd_exp, fid, suppgid, request);
 	return rc;
 }
 
-static 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;
-
-	return md_unpack_capa(lmv->tgts[0]->ltd_exp, req, field, oc);
-}
-
 static int lmv_intent_getattr_async(struct obd_export *exp,
 				    struct md_enqueue_info *minfo,
 				    struct ldlm_enqueue_info *einfo)
@@ -2821,8 +2790,6 @@ static struct md_ops lmv_md_ops = {
 	.m_free_lustre_md       = lmv_free_lustre_md,
 	.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
diff --git a/drivers/staging/lustre/lustre/lov/lov_io.c b/drivers/staging/lustre/lustre/lov/lov_io.c
index b5b2580..489227ae 100644
--- a/drivers/staging/lustre/lustre/lov/lov_io.c
+++ b/drivers/staging/lustre/lustre/lov/lov_io.c
@@ -90,7 +90,6 @@ static void lov_io_sub_inherit(struct cl_io *io, struct lov_io *lio,
 	case CIT_SETATTR: {
 		io->u.ci_setattr.sa_attr = parent->u.ci_setattr.sa_attr;
 		io->u.ci_setattr.sa_valid = parent->u.ci_setattr.sa_valid;
-		io->u.ci_setattr.sa_capa = parent->u.ci_setattr.sa_capa;
 		if (cl_io_is_trunc(io)) {
 			loff_t new_size = parent->u.ci_setattr.sa_attr.lvb_size;
 
@@ -111,7 +110,6 @@ static void lov_io_sub_inherit(struct cl_io *io, struct lov_io *lio,
 	case CIT_FSYNC: {
 		io->u.ci_fsync.fi_start = start;
 		io->u.ci_fsync.fi_end = end;
-		io->u.ci_fsync.fi_capa = parent->u.ci_fsync.fi_capa;
 		io->u.ci_fsync.fi_fid = parent->u.ci_fsync.fi_fid;
 		io->u.ci_fsync.fi_mode = parent->u.ci_fsync.fi_mode;
 		break;
diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c b/drivers/staging/lustre/lustre/lov/lov_obd.c
index d51311c..5c69ce9 100644
--- a/drivers/staging/lustre/lustre/lov/lov_obd.c
+++ b/drivers/staging/lustre/lustre/lov/lov_obd.c
@@ -1061,8 +1061,7 @@ do {									    \
 
 static int lov_destroy(const struct lu_env *env, struct obd_export *exp,
 		       struct obdo *oa, struct lov_stripe_md *lsm,
-		       struct obd_trans_info *oti, struct obd_export *md_exp,
-		       void *capa)
+		       struct obd_trans_info *oti, struct obd_export *md_exp)
 {
 	struct lov_request_set *set;
 	struct obd_info oinfo;
@@ -1094,7 +1093,7 @@ static int lov_destroy(const struct lu_env *env, struct obd_export *exp,
 			oti->oti_logcookies = set->set_cookies + req->rq_stripe;
 
 		err = obd_destroy(env, lov->lov_tgts[req->rq_idx]->ltd_exp,
-				  req->rq_oi.oi_oa, NULL, oti, NULL, capa);
+				  req->rq_oi.oi_oa, NULL, oti, NULL);
 		err = lov_update_common_set(set, req, err);
 		if (err) {
 			CERROR("%s: destroying objid "DOSTID" subobj "
@@ -2067,7 +2066,7 @@ static int lov_set_info_async(const struct lu_env *env, struct obd_export *exp,
 	struct lov_tgt_desc *tgt;
 	unsigned incr, check_uuid,
 		 do_inactive, no_set;
-	unsigned next_id = 0,  mds_con = 0, capa = 0;
+	unsigned next_id = 0,  mds_con = 0;
 
 	incr = check_uuid = do_inactive = no_set = 0;
 	if (set == NULL) {
@@ -2092,8 +2091,6 @@ static int lov_set_info_async(const struct lu_env *env, struct obd_export *exp,
 		/* use defaults:  do_inactive = incr = 0; */
 	} else if (KEY_IS(KEY_MDS_CONN)) {
 		mds_con = 1;
-	} else if (KEY_IS(KEY_CAPA_KEY)) {
-		capa = 1;
 	} else if (KEY_IS(KEY_CACHE_SET)) {
 		LASSERT(lov->lov_cache == NULL);
 		lov->lov_cache = val;
@@ -2132,19 +2129,6 @@ static int lov_set_info_async(const struct lu_env *env, struct obd_export *exp,
 			err = obd_set_info_async(env, tgt->ltd_exp,
 					 keylen, key, vallen,
 					 ((struct obd_id_info *)val)->data, set);
-		} else if (capa) {
-			struct mds_capa_info *info = (struct mds_capa_info *)val;
-
-			LASSERT(vallen == sizeof(*info));
-
-			 /* Only want a specific OSC */
-			if (info->uuid &&
-			    !obd_uuid_equals(info->uuid, &tgt->ltd_uuid))
-				continue;
-
-			err = obd_set_info_async(env, tgt->ltd_exp, keylen,
-						 key, sizeof(*info->capa),
-						 info->capa, set);
 		} else {
 			/* Only want a specific OSC */
 			if (check_uuid &&
diff --git a/drivers/staging/lustre/lustre/lov/lov_request.c b/drivers/staging/lustre/lustre/lov/lov_request.c
index 416e42e..104c92a 100644
--- a/drivers/staging/lustre/lustre/lov/lov_request.c
+++ b/drivers/staging/lustre/lustre/lov/lov_request.c
@@ -319,7 +319,6 @@ int lov_prep_getattr_set(struct obd_export *exp, struct obd_info *oinfo,
 		       sizeof(*req->rq_oi.oi_oa));
 		req->rq_oi.oi_oa->o_oi = loi->loi_oi;
 		req->rq_oi.oi_cb_up = cb_getattr_update;
-		req->rq_oi.oi_capa = oinfo->oi_capa;
 
 		lov_set_add_req(req, set);
 	}
@@ -518,7 +517,6 @@ int lov_prep_setattr_set(struct obd_export *exp, struct obd_info *oinfo,
 		req->rq_oi.oi_oa->o_oi = loi->loi_oi;
 		req->rq_oi.oi_oa->o_stripe_idx = i;
 		req->rq_oi.oi_cb_up = cb_setattr_update;
-		req->rq_oi.oi_capa = oinfo->oi_capa;
 
 		if (oinfo->oi_oa->o_valid & OBD_MD_FLSIZE) {
 			int off = lov_stripe_offset(oinfo->oi_md,
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_internal.h b/drivers/staging/lustre/lustre/mdc/mdc_internal.h
index 4d14943..29b46f7 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_internal.h
+++ b/drivers/staging/lustre/lustre/mdc/mdc_internal.h
@@ -43,17 +43,14 @@
 void lprocfs_mdc_init_vars(struct lprocfs_static_vars *lvars);
 
 void mdc_pack_body(struct ptlrpc_request *req, const struct lu_fid *fid,
-		   struct obd_capa *oc, __u64 valid, int ea_size,
-		   __u32 suppgid, int flags);
-void mdc_pack_capa(struct ptlrpc_request *req,
-		   const struct req_msg_field *field, struct obd_capa *oc);
+		   __u64 valid, int ea_size, __u32 suppgid, int flags);
 int mdc_pack_req(struct ptlrpc_request *req, int version, int opc);
 void mdc_is_subdir_pack(struct ptlrpc_request *req, const struct lu_fid *pfid,
 			const struct lu_fid *cfid, int 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, __u32 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, int flags,
 		      struct md_op_data *data, int ea_size);
 void mdc_setattr_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
@@ -140,17 +137,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);
 
-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);
 
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_lib.c b/drivers/staging/lustre/lustre/mdc/mdc_lib.c
index 1a850ea..ce0bcdf 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_lib.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_lib.c
@@ -52,24 +52,6 @@ static void __mdc_pack_body(struct mdt_body *b, __u32 suppgid)
 	b->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_is_subdir_pack(struct ptlrpc_request *req, const struct lu_fid *pfid,
 			const struct lu_fid *cfid, int flags)
 {
@@ -95,13 +77,9 @@ void mdc_swap_layouts_pack(struct ptlrpc_request *req,
 	b->fid1 = op_data->op_fid1;
 	b->fid2 = op_data->op_fid2;
 	b->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,
+void mdc_pack_body(struct ptlrpc_request *req, const struct lu_fid *fid,
 		   __u64 valid, int ea_size, __u32 suppgid, int flags)
 {
 	struct mdt_body *b = req_capsule_client_get(&req->rq_pill,
@@ -114,12 +92,11 @@ void mdc_pack_body(struct ptlrpc_request *req,
 	if (fid) {
 		b->fid1 = *fid;
 		b->valid |= OBD_MD_FLID;
-		mdc_pack_capa(req, &RMF_CAPA1, oc);
 	}
 }
 
 void mdc_readdir_pack(struct ptlrpc_request *req, __u64 pgoff,
-		      __u32 size, const struct lu_fid *fid, struct obd_capa *oc)
+		      __u32 size, const struct lu_fid *fid)
 {
 	struct mdt_body *b = req_capsule_client_get(&req->rq_pill,
 						    &RMF_MDT_BODY);
@@ -129,8 +106,6 @@ void mdc_readdir_pack(struct ptlrpc_request *req, __u64 pgoff,
 	b->nlink = size;			/* !! */
 	__mdc_pack_body(b, -1);
 	b->mode = LUDA_FID | LUDA_TYPE;
-
-	mdc_pack_capa(req, &RMF_CAPA1, oc);
 }
 
 /* packing of MDS records */
@@ -164,8 +139,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();
 
-	mdc_pack_capa(req, &RMF_CAPA1, op_data->op_capa1);
-
 	tmp = req_capsule_client_get(&req->rq_pill, &RMF_NAME);
 	LOGL0(op_data->op_name, op_data->op_namelen, tmp);
 
@@ -235,10 +208,6 @@ void mdc_open_pack(struct ptlrpc_request *req, struct md_op_data *op_data,
 	rec->cr_umask    = current_umask();
 	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) {
 		tmp = req_capsule_client_get(&req->rq_pill, &RMF_NAME);
 		LOGL0(op_data->op_name, op_data->op_namelen, tmp);
@@ -347,8 +316,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);
 
-	mdc_pack_capa(req, &RMF_CAPA1, op_data->op_capa1);
-
 	if (op_data->op_flags & (MF_SOM_CHANGE | MF_EPOCH_OPEN)) {
 		epoch = req_capsule_client_get(&req->rq_pill, &RMF_MDT_EPOCH);
 		mdc_ioepoch_pack(epoch, op_data);
@@ -396,8 +363,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;
 
-	mdc_pack_capa(req, &RMF_CAPA1, op_data->op_capa1);
-
 	tmp = req_capsule_client_get(&req->rq_pill, &RMF_NAME);
 	LASSERT(tmp != NULL);
 	LOGL0(op_data->op_name, op_data->op_namelen, tmp);
@@ -423,9 +388,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;
 
-	mdc_pack_capa(req, &RMF_CAPA1, op_data->op_capa1);
-	mdc_pack_capa(req, &RMF_CAPA2, op_data->op_capa2);
-
 	tmp = req_capsule_client_get(&req->rq_pill, &RMF_NAME);
 	LOGL0(op_data->op_name, op_data->op_namelen, tmp);
 }
@@ -452,9 +414,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;
 
-	mdc_pack_capa(req, &RMF_CAPA1, op_data->op_capa1);
-	mdc_pack_capa(req, &RMF_CAPA2, op_data->op_capa2);
-
 	tmp = req_capsule_client_get(&req->rq_pill, &RMF_NAME);
 	LOGL0(old, oldlen, tmp);
 
@@ -483,8 +442,6 @@ void mdc_getattr_pack(struct ptlrpc_request *req, __u64 valid, int flags,
 	b->fid2 = op_data->op_fid2;
 	b->valid |= OBD_MD_FLID;
 
-	mdc_pack_capa(req, &RMF_CAPA1, op_data->op_capa1);
-
 	if (op_data->op_name) {
 		char *tmp = req_capsule_client_get(&req->rq_pill, &RMF_NAME);
 
@@ -524,7 +481,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);
-	mdc_pack_capa(req, &RMF_CAPA1, op_data->op_capa1);
 	mdc_ioepoch_pack(epoch, op_data);
 	mdc_hsm_release_pack(req, op_data);
 }
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_locks.c b/drivers/staging/lustre/lustre/mdc/mdc_locks.c
index ebd9f76..5c34130 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_locks.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_locks.c
@@ -322,12 +322,6 @@ static struct ptlrpc_request *mdc_intent_open_pack(struct obd_export *exp,
 		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,
@@ -376,8 +370,6 @@ mdc_intent_getxattr_pack(struct obd_export *exp,
 	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);
@@ -391,8 +383,8 @@ mdc_intent_getxattr_pack(struct obd_export *exp,
 	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);
@@ -422,7 +414,6 @@ static struct ptlrpc_request *mdc_intent_unlink_pack(struct obd_export *exp,
 	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);
 
@@ -455,7 +446,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 |
-				       OBD_MD_FLMDSCAPA | OBD_MD_MEA |
+				       OBD_MD_MEA |
 				       (client_is_remote(exp) ?
 					       OBD_MD_FLRMTPERM : OBD_MD_FLACL);
 	struct ldlm_intent    *lit;
@@ -467,7 +458,6 @@ static struct ptlrpc_request *mdc_intent_getattr_pack(struct obd_export *exp,
 	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);
 
@@ -705,27 +695,6 @@ static int mdc_finish_enqueue(struct obd_export *exp,
 			if (perm == NULL)
 				return -EPROTO;
 		}
-		if (body->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->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 */
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_reint.c b/drivers/staging/lustre/lustre/mdc/mdc_reint.c
index 79e4fd4..c87c7d8 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_reint.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_reint.c
@@ -127,7 +127,6 @@ int mdc_setattr(struct obd_export *exp, struct md_op_data *op_data,
 		ldlm_lock_list_put(&cancels, l_bl_ast, count);
 		return -ENOMEM;
 	}
-	mdc_set_capa_size(req, &RMF_CAPA1, op_data->op_capa1);
 	if ((op_data->op_flags & (MF_SOM_CHANGE | MF_EPOCH_OPEN)) == 0)
 		req_capsule_set_size(&req->rq_pill, &RMF_MDT_EPOCH, RCL_CLIENT,
 				     0);
@@ -242,7 +241,6 @@ rebuild:
 		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,
@@ -296,18 +294,6 @@ rebuild:
 			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->valid & OBD_MD_FLMDSCAPA) {
-			capa = req_capsule_server_get(&req->rq_pill,
-						      &RMF_CAPA1);
-			if (capa == NULL)
-				rc = -EPROTO;
-		}
 	}
 
 	*request = req;
@@ -342,7 +328,6 @@ int mdc_unlink(struct obd_export *exp, struct md_op_data *op_data,
 		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);
 
@@ -392,8 +377,6 @@ int mdc_link(struct obd_export *exp, struct md_op_data *op_data,
 		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);
 
@@ -451,8 +434,6 @@ int mdc_rename(struct obd_export *exp, struct md_op_data *op_data,
 		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);
 
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c
index fd6fc10..8726176 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_request.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c
@@ -53,35 +53,8 @@
 
 #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_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;
-
-	/* 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);
-	}
-
-	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;
@@ -100,23 +73,20 @@ static inline int mdc_queue_wait(struct ptlrpc_request *req)
 	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;
 
-	req = ptlrpc_request_alloc_pack(imp, &RQF_MDS_GETSTATUS,
+	req = ptlrpc_request_alloc_pack(class_exp2cliimp(exp),
+					&RQF_MDS_GETSTATUS,
 					LUSTRE_MDS_VERSION, MDS_GETSTATUS);
 	if (req == NULL)
 		return -ENOMEM;
 
-	mdc_pack_body(req, NULL, NULL, 0, 0, -1, 0);
-	lustre_msg_add_flags(req->rq_reqmsg, msg_flags);
-	req->rq_send_state = level;
+	mdc_pack_body(req, NULL, 0, 0, -1, 0);
+	req->rq_send_state = LUSTRE_IMP_FULL;
 
 	ptlrpc_request_set_replen(req);
 
@@ -130,12 +100,6 @@ static int send_getstatus(struct obd_import *imp, struct lu_fid *rootfid,
 		goto out;
 	}
 
-	if (body->valid & OBD_MD_FLMDSCAPA) {
-		rc = mdc_unpack_capa(NULL, req, &RMF_CAPA1, pc);
-		if (rc)
-			goto out;
-	}
-
 	*rootfid = body->fid1;
 	CDEBUG(D_NET,
 	       "root fid="DFID", last_committed=%llu\n",
@@ -146,14 +110,6 @@ out:
 	return rc;
 }
 
-/* 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);
-}
-
 /*
  * This function now is known to always saying that it will receive 4 buffers
  * from server. Even for cases when acl_size and md_size is zero, RPC header
@@ -203,14 +159,6 @@ static int mdc_getattr_common(struct obd_export *exp,
 			return -EPROTO;
 	}
 
-	if (body->valid & OBD_MD_FLMDSCAPA) {
-		struct lustre_capa *capa;
-
-		capa = req_capsule_server_get(pill, &RMF_CAPA1);
-		if (capa == NULL)
-			return -EPROTO;
-	}
-
 	return 0;
 }
 
@@ -230,16 +178,14 @@ static int mdc_getattr(struct obd_export *exp, struct md_op_data *op_data,
 	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;
 	}
 
-	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);
@@ -270,7 +216,6 @@ static int mdc_getattr_name(struct obd_export *exp, struct md_op_data *op_data,
 	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);
 
@@ -280,9 +225,8 @@ static int mdc_getattr_name(struct obd_export *exp, struct md_op_data *op_data,
 		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);
@@ -333,7 +277,7 @@ static int mdc_is_subdir(struct obd_export *exp,
 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,
+			    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)
@@ -348,7 +292,6 @@ static int mdc_xattr_common(struct obd_export *exp,
 	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,
@@ -406,9 +349,8 @@ static int mdc_xattr_common(struct obd_export *exp,
 		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);
+		mdc_pack_body(req, fid, valid, output_size, suppgid, flags);
 	}
 
 	if (xattr_name) {
@@ -442,23 +384,24 @@ static int mdc_xattr_common(struct obd_export *exp,
 }
 
 static int mdc_setxattr(struct obd_export *exp, const struct lu_fid *fid,
-		 struct obd_capa *oc, u64 valid, const char *xattr_name,
-		 const char *input, int input_size, int output_size,
-		 int flags, __u32 suppgid, struct ptlrpc_request **request)
+			u64 valid, const char *xattr_name,
+			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,
+				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,
-		 struct obd_capa *oc, u64 valid, const char *xattr_name,
-		 const char *input, int input_size, int output_size,
-		 int flags, struct ptlrpc_request **request)
+			u64 valid, const char *xattr_name,
+			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,
+				fid, MDS_GETXATTR, valid, xattr_name,
 				input, input_size, output_size, flags,
 				-1, request);
 }
@@ -618,34 +561,9 @@ int mdc_get_lustre_md(struct obd_export *exp, struct ptlrpc_request *req,
 #endif
 		}
 	}
-	if (md->body->valid & OBD_MD_FLMDSCAPA) {
-		struct obd_capa *oc = NULL;
-
-		rc = mdc_unpack_capa(NULL, req, &RMF_CAPA1, &oc);
-		if (rc)
-			goto out;
-		md->mds_capa = oc;
-	}
-
-	if (md->body->valid & OBD_MD_FLOSSCAPA) {
-		struct obd_capa *oc = NULL;
-
-		rc = mdc_unpack_capa(NULL, req, &RMF_CAPA2, &oc);
-		if (rc)
-			goto out;
-		md->oss_capa = oc;
-	}
 
 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
@@ -887,8 +805,6 @@ static int mdc_close(struct obd_export *exp, struct md_op_data *op_data,
 	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);
@@ -989,7 +905,6 @@ static int mdc_done_writing(struct obd_export *exp, struct md_op_data *op_data,
 	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_DONE_WRITING);
 	if (rc) {
 		ptlrpc_request_free(req);
@@ -1066,8 +981,6 @@ restart_bulk:
 	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_READPAGE);
 	if (rc) {
 		ptlrpc_request_free(req);
@@ -1090,7 +1003,7 @@ restart_bulk:
 
 	mdc_readdir_pack(req, op_data->op_offset,
 			 PAGE_CACHE_SIZE * op_data->op_npages,
-			 &op_data->op_fid1, op_data->op_capa1);
+			 &op_data->op_fid1);
 
 	ptlrpc_request_set_replen(req);
 	rc = ptlrpc_queue_wait(req);
@@ -1253,7 +1166,7 @@ static int mdc_ioc_hsm_progress(struct obd_export *exp,
 		goto out;
 	}
 
-	mdc_pack_body(req, NULL, NULL, OBD_MD_FLRMTPERM, 0, 0, 0);
+	mdc_pack_body(req, NULL, OBD_MD_FLRMTPERM, 0, 0, 0);
 
 	/* Copy hsm_progress struct */
 	req_hpk = req_capsule_client_get(&req->rq_pill, &RMF_MDS_HSM_PROGRESS);
@@ -1288,7 +1201,7 @@ static int mdc_ioc_hsm_ct_register(struct obd_import *imp, __u32 archives)
 		goto out;
 	}
 
-	mdc_pack_body(req, NULL, NULL, OBD_MD_FLRMTPERM, 0, 0, 0);
+	mdc_pack_body(req, NULL, OBD_MD_FLRMTPERM, 0, 0, 0);
 
 	/* Copy hsm_progress struct */
 	archive_mask = req_capsule_client_get(&req->rq_pill,
@@ -1322,16 +1235,14 @@ static int mdc_ioc_hsm_current_action(struct obd_export *exp,
 	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;
 	}
 
-	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);
 
@@ -1366,7 +1277,7 @@ static int mdc_ioc_hsm_ct_unregister(struct obd_import *imp)
 		goto out;
 	}
 
-	mdc_pack_body(req, NULL, NULL, OBD_MD_FLRMTPERM, 0, 0, 0);
+	mdc_pack_body(req, NULL, OBD_MD_FLRMTPERM, 0, 0, 0);
 
 	ptlrpc_request_set_replen(req);
 
@@ -1390,16 +1301,14 @@ static int mdc_ioc_hsm_state_get(struct obd_export *exp,
 	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;
 	}
 
-	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);
 
@@ -1433,16 +1342,14 @@ static int mdc_ioc_hsm_state_set(struct obd_export *exp,
 	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;
 	}
 
-	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);
@@ -1490,7 +1397,7 @@ static int mdc_ioc_hsm_request(struct obd_export *exp,
 		return rc;
 	}
 
-	mdc_pack_body(req, NULL, NULL, OBD_MD_FLRMTPERM, 0, 0, 0);
+	mdc_pack_body(req, NULL, OBD_MD_FLRMTPERM, 0, 0, 0);
 
 	/* Copy hsm_request struct */
 	req_hr = req_capsule_client_get(&req->rq_pill, &RMF_MDS_HSM_REQUEST);
@@ -1799,9 +1706,6 @@ static int mdc_ioc_swap_layouts(struct obd_export *exp,
 		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);
@@ -2260,7 +2164,7 @@ static int mdc_get_info(const struct lu_env *env, struct obd_export *exp,
 }
 
 static int mdc_sync(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;
@@ -2270,15 +2174,13 @@ static int mdc_sync(struct obd_export *exp, const struct lu_fid *fid,
 	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;
 	}
 
-	mdc_pack_body(req, fid, oc, 0, 0, -1, 0);
+	mdc_pack_body(req, fid, 0, 0, -1, 0);
 
 	ptlrpc_request_set_replen(req);
 
@@ -2547,8 +2449,7 @@ static int mdc_process_config(struct obd_device *obd, u32 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,
-			       struct obd_capa *oc, __u32 suppgid,
-			       struct ptlrpc_request **request)
+			       __u32 suppgid, struct ptlrpc_request **request)
 {
 	struct ptlrpc_request  *req;
 	int		    rc;
@@ -2560,15 +2461,13 @@ static int mdc_get_remote_perm(struct obd_export *exp, const struct lu_fid *fid,
 	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;
 	}
 
-	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));
@@ -2583,66 +2482,6 @@ static int mdc_get_remote_perm(struct obd_export *exp, const struct lu_fid *fid,
 	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;
-
-	if (status) {
-		capa = ERR_PTR(status);
-		goto out;
-	}
-
-	body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
-	if (body == NULL) {
-		capa = ERR_PTR(-EFAULT);
-		goto out;
-	}
-
-	if ((body->valid & OBD_MD_FLOSSCAPA) == 0) {
-		capa = ERR_PTR(-ENOENT);
-		goto out;
-	}
-
-	capa = req_capsule_server_get(&req->rq_pill, &RMF_CAPA2);
-	if (!capa) {
-		capa = ERR_PTR(-EFAULT);
-		goto out;
-	}
-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;
-
-	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);
-	return 0;
-}
-
 static struct obd_ops mdc_obd_ops = {
 	.o_owner	    = THIS_MODULE,
 	.o_setup	    = mdc_setup,
@@ -2694,8 +2533,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_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
diff --git a/drivers/staging/lustre/lustre/obdclass/Makefile b/drivers/staging/lustre/lustre/obdclass/Makefile
index 16174ae..acc6857 100644
--- a/drivers/staging/lustre/lustre/obdclass/Makefile
+++ b/drivers/staging/lustre/lustre/obdclass/Makefile
@@ -5,5 +5,5 @@ obdclass-y := linux/linux-module.o linux/linux-obdo.o linux/linux-sysctl.o \
 	      genops.o uuid.o lprocfs_status.o \
 	      lustre_handles.o lustre_peer.o \
 	      statfs_pack.o obdo.o obd_config.o obd_mount.o \
-	      lu_object.o capa.o cl_object.o   \
+	      lu_object.o cl_object.o   \
 	      cl_page.o cl_lock.o cl_io.o lu_ref.o acl.o lprocfs_counters.o
diff --git a/drivers/staging/lustre/lustre/obdclass/capa.c b/drivers/staging/lustre/lustre/obdclass/capa.c
deleted file mode 100644
index 99af017..0000000
--- a/drivers/staging/lustre/lustre/obdclass/capa.c
+++ /dev/null
@@ -1,421 +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, 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@xxxxxxxxxxxxx>
- */
-
-#define DEBUG_SUBSYSTEM S_SEC
-
-#include <linux/fs.h>
-#include <asm/unistd.h>
-#include <linux/slab.h>
-#include <linux/module.h>
-#include <linux/crypto.h>
-
-#include "../include/obd_class.h"
-#include "../include/lustre_debug.h"
-#include "../include/lustre/lustre_idl.h"
-
-#include <linux/list.h>
-#include "../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);
-
-static inline
-unsigned int ll_crypto_tfm_alg_min_keysize(struct crypto_blkcipher *tfm)
-{
-	return crypto_blkcipher_tfm(tfm)->__crt_alg->cra_blkcipher.min_keysize;
-}
-
-struct hlist_head *init_capa_hash(void)
-{
-	struct hlist_head *hash;
-	int nr_hash, i;
-
-	hash = kzalloc(PAGE_CACHE_SIZE, GFP_NOFS);
-	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)
-{
-	int i;
-	struct hlist_node *next;
-	struct obd_capa *oc;
-
-	spin_lock(&capa_lock);
-	for (i = 0; i < NR_CAPAHASH; i++) {
-		hlist_for_each_entry_safe(oc, next, hash + i,
-					      u.tgt.c_hash)
-			capa_delete(oc);
-	}
-	spin_unlock(&capa_lock);
-
-	kfree(hash);
-}
-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 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 obd_capa *ocapa;
-	int len = alive ? offsetof(struct lustre_capa, lc_keyid):sizeof(*capa);
-
-	hlist_for_each_entry(ocapa, 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;
-	}
-	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);
-
-static inline int ll_crypto_hmac(struct crypto_hash *tfm,
-				 u8 *key, unsigned int *keylen,
-				 struct scatterlist *sg,
-				 unsigned int size, u8 *result)
-{
-	struct hash_desc desc;
-	int	      rv;
-	desc.tfm   = tfm;
-	desc.flags = 0;
-	rv = crypto_hash_setkey(desc.tfm, key, *keylen);
-	if (rv) {
-		CERROR("failed to hash setkey: %d\n", rv);
-		return rv;
-	}
-	return crypto_hash_digest(&desc, sg, size, result);
-}
-
-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";
-
-	/* 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);
-		rc = -EINVAL;
-		goto out;
-	}
-
-	rc = crypto_blkcipher_setkey(tfm, key, min);
-	if (rc) {
-		CERROR("failed to setting key for aes\n");
-		goto out;
-	}
-
-	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;
-	}
-
-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";
-
-	/* 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);
-		rc = -EINVAL;
-		goto out;
-	}
-
-	rc = crypto_blkcipher_setkey(tfm, key, min);
-	if (rc) {
-		CERROR("failed to setting key for aes\n");
-		goto out;
-	}
-
-	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;
-	}
-
-out:
-	crypto_free_blkcipher(tfm);
-	return rc;
-}
-EXPORT_SYMBOL(capa_decrypt_id);
-
-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 %#llx uid %llu gid %llu 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);
diff --git a/drivers/staging/lustre/lustre/obdclass/class_obd.c b/drivers/staging/lustre/lustre/obdclass/class_obd.c
index 39bf734..058b859d 100644
--- a/drivers/staging/lustre/lustre/obdclass/class_obd.c
+++ b/drivers/staging/lustre/lustre/obdclass/class_obd.c
@@ -479,9 +479,6 @@ static int __init init_obdclass(void)
 	int i, err;
 	int lustre_register_fs(void);
 
-	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);
diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c b/drivers/staging/lustre/lustre/obdclass/genops.c
index 44cb5bc..059611b 100644
--- a/drivers/staging/lustre/lustre/obdclass/genops.c
+++ b/drivers/staging/lustre/lustre/obdclass/genops.c
@@ -645,8 +645,6 @@ void obd_cleanup_caches(void)
 	obdo_cachep = NULL;
 	kmem_cache_destroy(import_cachep);
 	import_cachep = NULL;
-	kmem_cache_destroy(capa_cachep);
-	capa_cachep = NULL;
 }
 
 int obd_init_caches(void)
@@ -671,12 +669,6 @@ int obd_init_caches(void)
 	if (!import_cachep)
 		goto out;
 
-	LASSERT(!capa_cachep);
-	capa_cachep = kmem_cache_create("capa_cache",
-					   sizeof(struct obd_capa), 0, 0, NULL);
-	if (!capa_cachep)
-		goto out;
-
 	return 0;
  out:
 	obd_cleanup_caches();
diff --git a/drivers/staging/lustre/lustre/obdecho/echo_client.c b/drivers/staging/lustre/lustre/obdecho/echo_client.c
index 4feca2c..ec9ccff 100644
--- a/drivers/staging/lustre/lustre/obdecho/echo_client.c
+++ b/drivers/staging/lustre/lustre/obdecho/echo_client.c
@@ -1400,7 +1400,7 @@ static int echo_create_object(const struct lu_env *env, struct echo_device *ed,
 
  failed:
 	if (created && rc)
-		obd_destroy(env, ec->ec_exp, oa, lsm, oti, NULL, NULL);
+		obd_destroy(env, ec->ec_exp, oa, lsm, oti, NULL);
 	if (lsm)
 		echo_free_memmd(ed, &lsm);
 	if (rc)
@@ -1691,7 +1691,7 @@ static int echo_client_prep_commit(const struct lu_env *env,
 
 		lpages = npages;
 		ret = obd_preprw(env, rw, exp, oa, 1, &ioo, rnb, &lpages,
-				 lnb, oti, NULL);
+				 lnb, oti);
 		if (ret != 0)
 			goto out;
 		LASSERT(lpages == npages);
@@ -1907,7 +1907,7 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
 		rc = echo_get_object(&eco, ed, oa);
 		if (rc == 0) {
 			rc = obd_destroy(env, ec->ec_exp, oa, eco->eo_lsm,
-					 &dummy_oti, NULL, NULL);
+					 &dummy_oti, NULL);
 			if (rc == 0)
 				eco->eo_deleted = 1;
 			echo_put_object(eco);
diff --git a/drivers/staging/lustre/lustre/osc/osc_io.c b/drivers/staging/lustre/lustre/osc/osc_io.c
index 67bf0bd..8d7eab0 100644
--- a/drivers/staging/lustre/lustre/osc/osc_io.c
+++ b/drivers/staging/lustre/lustre/osc/osc_io.c
@@ -457,7 +457,6 @@ static int osc_io_setattr_start(const struct lu_env *env,
 		}
 
 		oinfo.oi_oa = oa;
-		oinfo.oi_capa = io->u.ci_setattr.sa_capa;
 		init_completion(&cbargs->opc_sync);
 
 		if (ia_valid & ATTR_SIZE)
@@ -564,7 +563,6 @@ static int osc_fsync_ost(const struct lu_env *env, struct osc_object *obj,
 
 	memset(oinfo, 0, sizeof(*oinfo));
 	oinfo->oi_oa = oa;
-	oinfo->oi_capa = fio->fi_capa;
 	init_completion(&cbargs->opc_sync);
 
 	rc = osc_sync_base(osc_export(obj), oinfo, osc_async_upcall, cbargs,
diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c
index 5491a39..225e5ed 100644
--- a/drivers/staging/lustre/lustre/osc/osc_request.c
+++ b/drivers/staging/lustre/lustre/osc/osc_request.c
@@ -72,7 +72,6 @@ struct osc_brw_async_args {
 	struct client_obd *aa_cli;
 	struct list_head	 aa_oaps;
 	struct list_head	 aa_exts;
-	struct obd_capa   *aa_ocapa;
 	struct cl_req     *aa_clerq;
 };
 
@@ -200,22 +199,6 @@ static int osc_unpackmd(struct obd_export *exp, struct lov_stripe_md **lsmp,
 	return lsm_size;
 }
 
-static inline void osc_pack_capa(struct ptlrpc_request *req,
-				 struct ost_body *body, void *capa)
-{
-	struct obd_capa *oc = (struct obd_capa *)capa;
-	struct lustre_capa *c;
-
-	if (!capa)
-		return;
-
-	c = req_capsule_client_get(&req->rq_pill, &RMF_CAPA1);
-	LASSERT(c);
-	capa_cpy(c, oc);
-	body->oa.o_valid |= OBD_MD_FLOSSCAPA;
-	DEBUG_CAPA(D_SEC, c, "pack");
-}
-
 static inline void osc_pack_req_body(struct ptlrpc_request *req,
 				     struct obd_info *oinfo)
 {
@@ -226,18 +209,6 @@ static inline void osc_pack_req_body(struct ptlrpc_request *req,
 
 	lustre_set_wire_obdo(&req->rq_import->imp_connect_data, &body->oa,
 			     oinfo->oi_oa);
-	osc_pack_capa(req, body, oinfo->oi_capa);
-}
-
-static inline void osc_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 */
-		;
 }
 
 static int osc_getattr_interpret(const struct lu_env *env,
@@ -279,7 +250,6 @@ static int osc_getattr_async(struct obd_export *exp, struct obd_info *oinfo,
 	if (req == NULL)
 		return -ENOMEM;
 
-	osc_set_capa_size(req, &RMF_CAPA1, oinfo->oi_capa);
 	rc = ptlrpc_request_pack(req, LUSTRE_OST_VERSION, OST_GETATTR);
 	if (rc) {
 		ptlrpc_request_free(req);
@@ -310,7 +280,6 @@ static int osc_getattr(const struct lu_env *env, struct obd_export *exp,
 	if (req == NULL)
 		return -ENOMEM;
 
-	osc_set_capa_size(req, &RMF_CAPA1, oinfo->oi_capa);
 	rc = ptlrpc_request_pack(req, LUSTRE_OST_VERSION, OST_GETATTR);
 	if (rc) {
 		ptlrpc_request_free(req);
@@ -356,7 +325,6 @@ static int osc_setattr(const struct lu_env *env, struct obd_export *exp,
 	if (req == NULL)
 		return -ENOMEM;
 
-	osc_set_capa_size(req, &RMF_CAPA1, oinfo->oi_capa);
 	rc = ptlrpc_request_pack(req, LUSTRE_OST_VERSION, OST_SETATTR);
 	if (rc) {
 		ptlrpc_request_free(req);
@@ -420,7 +388,6 @@ int osc_setattr_async_base(struct obd_export *exp, struct obd_info *oinfo,
 	if (req == NULL)
 		return -ENOMEM;
 
-	osc_set_capa_size(req, &RMF_CAPA1, oinfo->oi_capa);
 	rc = ptlrpc_request_pack(req, LUSTRE_OST_VERSION, OST_SETATTR);
 	if (rc) {
 		ptlrpc_request_free(req);
@@ -566,7 +533,6 @@ int osc_punch_base(struct obd_export *exp, struct obd_info *oinfo,
 	if (req == NULL)
 		return -ENOMEM;
 
-	osc_set_capa_size(req, &RMF_CAPA1, oinfo->oi_capa);
 	rc = ptlrpc_request_pack(req, LUSTRE_OST_VERSION, OST_PUNCH);
 	if (rc) {
 		ptlrpc_request_free(req);
@@ -579,7 +545,6 @@ int osc_punch_base(struct obd_export *exp, struct obd_info *oinfo,
 	LASSERT(body);
 	lustre_set_wire_obdo(&req->rq_import->imp_connect_data, &body->oa,
 			     oinfo->oi_oa);
-	osc_pack_capa(req, body, oinfo->oi_capa);
 
 	ptlrpc_request_set_replen(req);
 
@@ -633,7 +598,6 @@ int osc_sync_base(struct obd_export *exp, struct obd_info *oinfo,
 	if (req == NULL)
 		return -ENOMEM;
 
-	osc_set_capa_size(req, &RMF_CAPA1, oinfo->oi_capa);
 	rc = ptlrpc_request_pack(req, LUSTRE_OST_VERSION, OST_SYNC);
 	if (rc) {
 		ptlrpc_request_free(req);
@@ -645,7 +609,6 @@ int osc_sync_base(struct obd_export *exp, struct obd_info *oinfo,
 	LASSERT(body);
 	lustre_set_wire_obdo(&req->rq_import->imp_connect_data, &body->oa,
 			     oinfo->oi_oa);
-	osc_pack_capa(req, body, oinfo->oi_capa);
 
 	ptlrpc_request_set_replen(req);
 	req->rq_interpret_reply = osc_sync_interpret;
@@ -763,8 +726,7 @@ int osc_create(const struct lu_env *env, struct obd_export *exp,
  * cookies to the MDS after committing destroy transactions. */
 static int osc_destroy(const struct lu_env *env, struct obd_export *exp,
 		       struct obdo *oa, struct lov_stripe_md *ea,
-		       struct obd_trans_info *oti, struct obd_export *md_export,
-		       void *capa)
+		       struct obd_trans_info *oti, struct obd_export *md_export)
 {
 	struct client_obd *cli = &exp->exp_obd->u.cli;
 	struct ptlrpc_request *req;
@@ -786,7 +748,6 @@ static int osc_destroy(const struct lu_env *env, struct obd_export *exp,
 		return -ENOMEM;
 	}
 
-	osc_set_capa_size(req, &RMF_CAPA1, (struct obd_capa *)capa);
 	rc = ldlm_prep_elc_req(exp, req, LUSTRE_OST_VERSION, OST_DESTROY,
 			       0, &cancels, count);
 	if (rc) {
@@ -803,7 +764,6 @@ static int osc_destroy(const struct lu_env *env, struct obd_export *exp,
 	LASSERT(body);
 	lustre_set_wire_obdo(&req->rq_import->imp_connect_data, &body->oa, oa);
 
-	osc_pack_capa(req, body, (struct obd_capa *)capa);
 	ptlrpc_request_set_replen(req);
 
 	/* If osc_destroy is for destroying the unlink orphan,
@@ -1256,7 +1216,7 @@ static int osc_brw_prep_request(int cmd, struct client_obd *cli,
 				struct lov_stripe_md *lsm, u32 page_count,
 				struct brw_page **pga,
 				struct ptlrpc_request **reqp,
-				struct obd_capa *ocapa, int reserve,
+				int reserve,
 				int resend)
 {
 	struct ptlrpc_request *req;
@@ -1296,7 +1256,6 @@ static int osc_brw_prep_request(int cmd, struct client_obd *cli,
 			     sizeof(*ioobj));
 	req_capsule_set_size(pill, &RMF_NIOBUF_REMOTE, RCL_CLIENT,
 			     niocount * sizeof(*niobuf));
-	osc_set_capa_size(req, &RMF_CAPA1, ocapa);
 
 	rc = ptlrpc_request_pack(req, LUSTRE_OST_VERSION, opc);
 	if (rc) {
@@ -1335,7 +1294,6 @@ static int osc_brw_prep_request(int cmd, struct client_obd *cli,
 	 * "max - 1" for old client compatibility sending "0", and also so the
 	 * the actual maximum is a power-of-two number, not one less. LU-1431 */
 	ioobj_max_brw_set(ioobj, desc->bd_md_max_brw);
-	osc_pack_capa(req, body, ocapa);
 	LASSERT(page_count > 0);
 	pg_prev = pga[0];
 	for (requested_nob = i = 0; i < page_count; i++, niobuf++) {
@@ -1444,8 +1402,6 @@ static int osc_brw_prep_request(int cmd, struct client_obd *cli,
 	aa->aa_ppga = pga;
 	aa->aa_cli = cli;
 	INIT_LIST_HEAD(&aa->aa_oaps);
-	if (ocapa && reserve)
-		aa->aa_ocapa = capa_get(ocapa);
 
 	*reqp = req;
 	return 0;
@@ -1667,7 +1623,7 @@ static int osc_brw_redo_request(struct ptlrpc_request *request,
 				  aa->aa_cli, aa->aa_oa,
 				  NULL /* lsm unused by osc currently */,
 				  aa->aa_page_count, aa->aa_ppga,
-				  &new_req, aa->aa_ocapa, 0, 1);
+				  &new_req, 0, 1);
 	if (rc)
 		return rc;
 
@@ -1711,9 +1667,6 @@ static int osc_brw_redo_request(struct ptlrpc_request *request,
 		}
 	}
 
-	new_aa->aa_ocapa = aa->aa_ocapa;
-	aa->aa_ocapa = NULL;
-
 	/* XXX: This code will run into problem if we're going to support
 	 * to add a series of BRW RPCs into a self-defined ptlrpc_request_set
 	 * and wait for all of them to be finished. We should inherit request
@@ -1795,11 +1748,6 @@ static int brw_interpret(const struct lu_env *env,
 			rc = -EIO;
 	}
 
-	if (aa->aa_ocapa) {
-		capa_put(aa->aa_ocapa);
-		aa->aa_ocapa = NULL;
-	}
-
 	list_for_each_entry_safe(ext, tmp, &aa->aa_exts, oe_link) {
 		if (obj == NULL && rc == 0) {
 			obj = osc2cl(ext->oe_obj);
@@ -1975,7 +1923,7 @@ int osc_build_rpc(const struct lu_env *env, struct client_obd *cli,
 
 	sort_brw_pages(pga, page_count);
 	rc = osc_brw_prep_request(cmd, cli, oa, NULL, page_count,
-			pga, &req, crattr->cra_capa, 1, 0);
+			pga, &req, 1, 0);
 	if (rc != 0) {
 		CERROR("prep_req failed: %d\n", rc);
 		goto out;
@@ -2051,7 +1999,6 @@ out:
 		cfs_memory_pressure_restore(mpflag);
 
 	if (crattr != NULL) {
-		capa_put(crattr->cra_capa);
 		kfree(crattr);
 	}
 
-- 
2.1.0

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux