#include <lustre_disk.h>
#include <lustre_param.h>
#include <lustre_log.h>
+#include <obd_cksum.h>
#include "llite_internal.h"
cfs_mem_cache_t *ll_file_data_slab;
RETURN(rc);
}
-static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
- uid_t nllu, gid_t nllg)
+static int client_common_fill_super(struct super_block *sb, char *md, char *dt)
{
struct inode *root = 0;
struct ll_sb_info *sbi = ll_s2sbi(sb);
}
/* indicate the features supported by this client */
- data->ocd_connect_flags = OBD_CONNECT_IBITS | OBD_CONNECT_NODEVOH |
- OBD_CONNECT_JOIN |
- OBD_CONNECT_ATTRFID | OBD_CONNECT_VERSION |
- OBD_CONNECT_MDS_CAPA | OBD_CONNECT_OSS_CAPA |
- OBD_CONNECT_CANCELSET;
+ data->ocd_connect_flags = OBD_CONNECT_IBITS | OBD_CONNECT_NODEVOH |
+ OBD_CONNECT_JOIN | OBD_CONNECT_ATTRFID |
+ OBD_CONNECT_VERSION | OBD_CONNECT_MDS_CAPA |
+ OBD_CONNECT_OSS_CAPA | OBD_CONNECT_CANCELSET|
+ OBD_CONNECT_FID;
+
#ifdef HAVE_LRU_RESIZE_SUPPORT
if (sbi->ll_flags & LL_SBI_LRU_RESIZE)
data->ocd_connect_flags |= OBD_CONNECT_LRU_RESIZE;
data->ocd_connect_flags &= ~OBD_CONNECT_RMT_CLIENT;
data->ocd_connect_flags |= OBD_CONNECT_LCL_CLIENT;
}
- data->ocd_nllu = nllu;
- data->ocd_nllg = nllg;
err = obd_connect(NULL, &md_conn, obd, &sbi->ll_sb_uuid, data);
if (err == -EBUSY) {
GOTO(out_md, err);
}
- err = obd_statfs(obd, &osfs, cfs_time_current_64() - HZ);
+ err = obd_statfs(obd, &osfs, cfs_time_current_64() - HZ, 0);
if (err)
GOTO(out_md_fid, err);
GOTO(out_md_fid, err = -ENODEV);
}
- data->ocd_connect_flags = OBD_CONNECT_GRANT | OBD_CONNECT_VERSION |
+ data->ocd_connect_flags = OBD_CONNECT_GRANT | OBD_CONNECT_VERSION |
OBD_CONNECT_REQPORTAL | OBD_CONNECT_BRW_SIZE |
- OBD_CONNECT_CANCELSET;
+ OBD_CONNECT_CANCELSET | OBD_CONNECT_FID;
if (sbi->ll_flags & LL_SBI_OSS_CAPA)
data->ocd_connect_flags |= OBD_CONNECT_OSS_CAPA;
+ if (!OBD_FAIL_CHECK(OBD_FAIL_OSC_CONNECT_CKSUM)) {
+ /* OBD_CONNECT_CKSUM should always be set, even if checksums are
+ * disabled by default, because it can still be enabled on the
+ * fly via /proc. As a consequence, we still need to come to an
+ * agreement on the supported algorithms at connect time */
+ data->ocd_connect_flags |= OBD_CONNECT_CKSUM;
+
+ if (OBD_FAIL_CHECK(OBD_FAIL_OSC_CKSUM_ADLER_ONLY))
+ data->ocd_cksum_types = OBD_CKSUM_ADLER;
+ else
+ /* send the list of supported checksum types */
+ data->ocd_cksum_types = OBD_CKSUM_ALL;
+ }
+
#ifdef HAVE_LRU_RESIZE_SUPPORT
data->ocd_connect_flags |= OBD_CONNECT_LRU_RESIZE;
#endif
GOTO(out_dt_fid, err);
}
memset(&lmd, 0, sizeof(lmd));
- err = md_get_lustre_md(sbi->ll_md_exp, request,
- REPLY_REC_OFF, sbi->ll_dt_exp, sbi->ll_md_exp,
- &lmd);
+ err = md_get_lustre_md(sbi->ll_md_exp, request, sbi->ll_dt_exp,
+ sbi->ll_md_exp, &lmd);
if (err) {
CERROR("failed to understand root inode md: rc = %d\n", err);
ptlrpc_req_finished (request);
GOTO(out_root, err);
}
+#ifdef CONFIG_FS_POSIX_ACL
+ if (sbi->ll_flags & LL_SBI_RMT_CLIENT) {
+ rct_init(&sbi->ll_rct);
+ et_init(&sbi->ll_et);
+ }
+#endif
+
checksum = sbi->ll_flags & LL_SBI_CHECKSUM;
err = obd_set_info_async(sbi->ll_dt_exp, strlen("checksum"),"checksum",
sizeof(checksum), &checksum, NULL);
struct ll_sb_info *sbi = ll_s2sbi(sb);
ENTRY;
+#ifdef CONFIG_FS_POSIX_ACL
+ if (sbi->ll_flags & LL_SBI_RMT_CLIENT) {
+ et_fini(&sbi->ll_et);
+ rct_fini(&sbi->ll_rct);
+ }
+#endif
+
obd_cancel_unused(sbi->ll_dt_exp, NULL, 0, NULL);
ll_close_thread_shutdown(sbi->ll_lcq);
cfs_module_get();
- sb->s_type->fs_flags |= FS_ODD_RENAME;
+ sb->s_type->fs_flags |= FS_RENAME_DOES_D_MOVE;
/* client additional sb info */
lsi->lsi_llsbi = sbi = ll_init_sbi();
if (!sbi) {
sprintf(md, "%s-%s", lprof->lp_md, ll_instance);
/* connections, registrations, sb setup */
- err = client_common_fill_super(sb, md, dt,
- lsi->lsi_lmd->lmd_nllu,
- lsi->lsi_lmd->lmd_nllg);
+ err = client_common_fill_super(sb, md, dt);
out_free:
if (md)
RETURN(rc);
}
- rc = md_get_lustre_md(sbi->ll_md_exp, request, REPLY_REC_OFF,
- sbi->ll_dt_exp, sbi->ll_md_exp, &md);
+ rc = md_get_lustre_md(sbi->ll_md_exp, request, sbi->ll_dt_exp,
+ sbi->ll_md_exp, &md);
if (rc) {
ptlrpc_req_finished(request);
RETURN(rc);
OBD_ALLOC_PTR(op_data);
if (op_data == NULL)
RETURN(-ENOMEM);
-
+
memcpy(&op_data->op_attr, attr, sizeof(*attr));
/* Open epoch for truncate. */
- if (ia_valid & ATTR_SIZE)
+ if ((ll_i2mdexp(inode)->exp_connect_flags & OBD_CONNECT_SOM) &&
+ (ia_valid & ATTR_SIZE))
op_data->op_flags = MF_EPOCH_OPEN;
-
+
rc = ll_md_setattr(inode, op_data, &mod);
if (rc)
GOTO(out, rc);
}
int ll_statfs_internal(struct super_block *sb, struct obd_statfs *osfs,
- __u64 max_age)
+ __u64 max_age, __u32 flags)
{
struct ll_sb_info *sbi = ll_s2sbi(sb);
struct obd_statfs obd_osfs;
int rc;
ENTRY;
- rc = obd_statfs(class_exp2obd(sbi->ll_md_exp), osfs, max_age);
+ rc = obd_statfs(class_exp2obd(sbi->ll_md_exp), osfs, max_age, flags);
if (rc) {
CERROR("md_statfs fails: rc = %d\n", rc);
RETURN(rc);
osfs->os_bavail, osfs->os_blocks, osfs->os_ffree,osfs->os_files);
rc = obd_statfs_rqset(class_exp2obd(sbi->ll_dt_exp),
- &obd_osfs, max_age);
+ &obd_osfs, max_age, flags);
if (rc) {
CERROR("obd_statfs fails: rc = %d\n", rc);
RETURN(rc);
/* For now we will always get up-to-date statfs values, but in the
* future we may allow some amount of caching on the client (e.g.
* from QOS or lprocfs updates). */
- rc = ll_statfs_internal(sb, &osfs, cfs_time_current_64() - 1);
+ rc = ll_statfs_internal(sb, &osfs, cfs_time_current_64() - 1, 0);
if (rc)
return rc;
"the size got from MDS\n",
inode->i_ino, lli->lli_flags);
} else {
- i_size_write(inode, body->size);
+ /* Use old size assignment to avoid
+ * deadlock bz14138 & bz14326 */
+ inode->i_size = body->size;
lli->lli_flags |= LLIF_MDS_SIZE_LOCK;
}
ldlm_lock_decref(&lockh, mode);
}
} else {
- i_size_write(inode, body->size);
+ /* Use old size assignment to avoid
+ * deadlock bz14138 & bz14326 */
+ inode->i_size = body->size;
}
if (body->valid & OBD_MD_FLBLOCKS)
if (rc) {
CERROR("fid_delete() failed, rc %d\n", rc);
}
+ truncate_inode_pages(&inode->i_data, 0);
clear_inode(inode);
EXIT;
RETURN(-abs(rc));
}
- body = lustre_msg_buf(req->rq_repmsg, REPLY_REC_OFF,
- sizeof(*body));
+ body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
+
flags = body->flags;
- ptlrpc_req_finished (req);
+ ptlrpc_req_finished(req);
RETURN(put_user(flags, (int *)arg));
}
return 0;
}
-int ll_prep_inode(struct inode **inode, struct ptlrpc_request *req,
- int offset, struct super_block *sb)
+int ll_prep_inode(struct inode **inode,
+ struct ptlrpc_request *req,
+ struct super_block *sb)
{
struct ll_sb_info *sbi = NULL;
struct lustre_md md;
prune_deathrow(sbi, 1);
memset(&md, 0, sizeof(struct lustre_md));
- rc = md_get_lustre_md(sbi->ll_md_exp, req, offset,
- sbi->ll_dt_exp, sbi->ll_md_exp, &md);
+ rc = md_get_lustre_md(sbi->ll_md_exp, req, sbi->ll_dt_exp,
+ sbi->ll_md_exp, &md);
if (rc)
RETURN(rc);
int ll_obd_statfs(struct inode *inode, void *arg)
{
struct ll_sb_info *sbi = NULL;
- struct obd_device *client_obd = NULL, *lov_obd = NULL;
- struct lov_obd *lov = NULL;
- struct obd_statfs stat_buf = {0};
+ struct obd_export *exp;
char *buf = NULL;
struct obd_ioctl_data *data = NULL;
- __u32 type, index;
+ __u32 type;
int len = 0, rc;
if (!inode || !(sbi = ll_i2sbi(inode)))
GOTO(out_statfs, rc = -EINVAL);
memcpy(&type, data->ioc_inlbuf1, sizeof(__u32));
- memcpy(&index, data->ioc_inlbuf2, sizeof(__u32));
-
- if (type == LL_STATFS_MDC) {
- if (index > 0)
- GOTO(out_statfs, rc = -ENODEV);
- client_obd = class_exp2obd(sbi->ll_md_exp);
- } else if (type == LL_STATFS_LOV) {
- lov_obd = class_exp2obd(sbi->ll_dt_exp);
- lov = &lov_obd->u.lov;
-
- if ((index >= lov->desc.ld_tgt_count))
- GOTO(out_statfs, rc = -ENODEV);
- if (!lov->lov_tgts[index])
- /* Try again with the next index */
- GOTO(out_statfs, rc = -EAGAIN);
-
- client_obd = class_exp2obd(lov->lov_tgts[index]->ltd_exp);
- if (!lov->lov_tgts[index]->ltd_active)
- GOTO(out_uuid, rc = -ENODATA);
- }
-
- if (!client_obd)
- GOTO(out_statfs, rc = -EINVAL);
-
- rc = obd_statfs(client_obd, &stat_buf, cfs_time_current_64() - 1);
+ if (type == LL_STATFS_MDC)
+ exp = sbi->ll_md_exp;
+ else if (type == LL_STATFS_LOV)
+ exp = sbi->ll_dt_exp;
+ else
+ GOTO(out_statfs, rc = -ENODEV);
+
+ rc = obd_iocontrol(IOC_OBD_STATFS, exp, len, buf, NULL);
if (rc)
GOTO(out_statfs, rc);
-
- if (copy_to_user(data->ioc_pbuf1, &stat_buf, data->ioc_plen1))
- GOTO(out_statfs, rc = -EFAULT);
-
-out_uuid:
- if (copy_to_user(data->ioc_pbuf2, obd2cli_tgt(client_obd),
- data->ioc_plen2))
- rc = -EFAULT;
-
out_statfs:
if (buf)
obd_ioctl_freedata(buf, len);
unsigned long x;
int rc = 0;
- lprocfs_init_vars(llite, &lvars);
+ lprocfs_llite_init_vars(&lvars);
/* The instance name contains the sb: lustre-client-aacfe000 */
ptr = strrchr(lustre_cfg_string(lcfg, 0), '-');
capa_put(op_data->op_capa2);
OBD_FREE_PTR(op_data);
}
-
-int ll_ioctl_getfacl(struct inode *inode, struct rmtacl_ioctl_data *ioc)
-{
- struct ll_sb_info *sbi = ll_i2sbi(inode);
- struct ptlrpc_request *req = NULL;
- struct mdt_body *body;
- char *cmd, *buf;
- struct obd_capa *oc;
- int rc, buflen;
- ENTRY;
-
- if (!(sbi->ll_flags & LL_SBI_RMT_CLIENT))
- RETURN(-EBADE);
-
- LASSERT(ioc->cmd && ioc->cmd_len && ioc->res && ioc->res_len);
-
- OBD_ALLOC(cmd, ioc->cmd_len);
- if (!cmd)
- RETURN(-ENOMEM);
- if (copy_from_user(cmd, ioc->cmd, ioc->cmd_len))
- GOTO(out, rc = -EFAULT);
-
- oc = ll_mdscapa_get(inode);
- rc = md_getxattr(ll_i2sbi(inode)->ll_md_exp, ll_inode2fid(inode), oc,
- OBD_MD_FLXATTR, XATTR_NAME_LUSTRE_ACL, cmd,
- ioc->cmd_len, ioc->res_len, 0, &req);
- capa_put(oc);
- if (rc < 0) {
- CERROR("mdc_getxattr %s [%s] failed: %d\n",
- XATTR_NAME_LUSTRE_ACL, cmd, rc);
- GOTO(out, rc);
- }
-
- body = lustre_msg_buf(req->rq_repmsg, REPLY_REC_OFF, sizeof(*body));
- LASSERT(body);
-
- buflen = lustre_msg_buflen(req->rq_repmsg, REPLY_REC_OFF);
- LASSERT(buflen <= ioc->res_len);
- buf = lustre_msg_string(req->rq_repmsg, REPLY_REC_OFF + 1, ioc->res_len);
- LASSERT(buf);
- if (copy_to_user(ioc->res, buf, buflen))
- GOTO(out, rc = -EFAULT);
- EXIT;
-out:
- if (req)
- ptlrpc_req_finished(req);
- OBD_FREE(cmd, ioc->cmd_len);
- return rc;
-}
-
-int ll_ioctl_setfacl(struct inode *inode, struct rmtacl_ioctl_data *ioc)
-{
- struct ll_sb_info *sbi = ll_i2sbi(inode);
- struct ptlrpc_request *req = NULL;
- char *cmd, *buf;
- struct obd_capa *oc;
- int buflen, rc;
- ENTRY;
-
- if (!(sbi->ll_flags & LL_SBI_RMT_CLIENT))
- RETURN(-EBADE);
-
- if (!(sbi->ll_flags & LL_SBI_ACL))
- RETURN(-EOPNOTSUPP);
-
- LASSERT(ioc->cmd && ioc->cmd_len && ioc->res && ioc->res_len);
-
- OBD_ALLOC(cmd, ioc->cmd_len);
- if (!cmd)
- RETURN(-ENOMEM);
- if (copy_from_user(cmd, ioc->cmd, ioc->cmd_len))
- GOTO(out, rc = -EFAULT);
-
- oc = ll_mdscapa_get(inode);
- rc = md_setxattr(ll_i2sbi(inode)->ll_md_exp, ll_inode2fid(inode), oc,
- OBD_MD_FLXATTR, XATTR_NAME_LUSTRE_ACL, cmd,
- ioc->cmd_len, ioc->res_len, 0, &req);
- capa_put(oc);
- if (rc) {
- CERROR("mdc_setxattr %s [%s] failed: %d\n",
- XATTR_NAME_LUSTRE_ACL, cmd, rc);
- GOTO(out, rc);
- }
-
- buflen = lustre_msg_buflen(req->rq_repmsg, REPLY_REC_OFF);
- LASSERT(buflen <= ioc->res_len);
- buf = lustre_msg_string(req->rq_repmsg, REPLY_REC_OFF, ioc->res_len);
- LASSERT(buf);
- if (copy_to_user(ioc->res, buf, buflen))
- GOTO(out, rc = -EFAULT);
- EXIT;
-out:
- if (req)
- ptlrpc_req_finished(req);
- OBD_FREE(cmd, ioc->cmd_len);
- return rc;
-}