* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2014, Intel Corporation.
+ * Copyright (c) 2012, 2015, Intel Corporation.
*/
/*
* lustre/osp/osp_object.c
#define DEBUG_SUBSYSTEM S_MDS
+#include <lustre_obdo.h>
+#include <lustre_swab.h>
+
#include "osp_internal.h"
static inline __u32 osp_dev2node(struct osp_device *osp)
mutex_lock(&osp->opd_async_requests_mutex);
rc = osp_insert_async_request(env, OUT_ATTR_GET, obj, 0, NULL, NULL,
&obj->opo_ooa->ooa_attr,
+ sizeof(struct obdo),
osp_attr_get_interpterer);
mutex_unlock(&osp->opd_async_requests_mutex);
if (obj->opo_ooa != NULL) {
spin_lock(&obj->opo_lock);
- if (obj->opo_ooa->ooa_attr.la_valid != 0) {
+ if (obj->opo_ooa->ooa_attr.la_valid != 0 && !obj->opo_stale) {
*attr = obj->opo_ooa->ooa_attr;
spin_unlock(&obj->opo_lock);
if (rc != 0)
GOTO(out, rc);
- GOTO(out, rc = 0);
+ spin_lock(&obj->opo_lock);
+ if (obj->opo_stale)
+ obj->opo_stale = 0;
+ spin_unlock(&obj->opo_lock);
+
+ GOTO(out, rc);
out:
if (req != NULL)
mutex_lock(&osp->opd_async_requests_mutex);
rc = osp_insert_async_request(env, OUT_XATTR_GET, obj, 1,
- &namelen, (const void **)&name, oxe,
+ &namelen, (const void **)&name,
+ oxe, buf->lb_len,
osp_xattr_get_interpterer);
if (rc != 0) {
mutex_unlock(&osp->opd_async_requests_mutex);
GOTO(out, rc = PTR_ERR(update));
rc = osp_update_rpc_pack(env, xattr_get, update, OUT_XATTR_GET,
- lu_object_fid(&dt->do_lu), name);
+ lu_object_fid(&dt->do_lu), name, buf->lb_len);
if (rc != 0) {
CERROR("%s: Insert update error "DFID": rc = %d\n",
dname, PFID(lu_object_fid(&dt->do_lu)), rc);
}
rc = osp_remote_sync(env, osp, update, &req);
- if (rc != 0) {
+ if (rc < 0) {
if (rc == -ENOENT) {
dt->do_lu.lo_header->loh_attr &= ~LOHA_EXISTS;
obj->opo_non_exist = 1;
GOTO(out, rc);
if (buf->lb_buf == NULL)
- GOTO(out, rc = rbuf->lb_len);
+ GOTO(out, rc);
if (unlikely(buf->lb_len < rbuf->lb_len))
GOTO(out, rc = -ERANGE);
memcpy(buf->lb_buf, rbuf->lb_buf, rbuf->lb_len);
- rc = rbuf->lb_len;
if (obj->opo_ooa == NULL || osp->opd_connect_mdt)
GOTO(out, rc);
struct lu_device *dev = it->ooi_obj->do_lu.lo_dev;
struct osp_device *osp = lu2osp_dev(dev);
struct page **pages;
+ struct lu_device *top_device;
struct ptlrpc_request *req = NULL;
struct ptlrpc_bulk_desc *desc;
struct idx_info *ii;
RETURN(rc);
}
+ /* Let's allow this request during recovery, otherwise
+ * if the remote target is also in recovery status,
+ * it might cause deadlock */
+ top_device = dev->ld_site->ls_top_dev;
+ if (top_device->ld_obd->obd_recovering)
+ req->rq_allow_replay = 1;
+
req->rq_request_portal = OUT_PORTAL;
ii = req_capsule_client_get(&req->rq_pill, &RMF_IDX_INFO);
memset(ii, 0, sizeof(*ii));