#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;
SBI_DEFAULT_READAHEAD_MAX);
sbi->ll_ra_info.ra_max_read_ahead_whole_pages =
SBI_DEFAULT_READAHEAD_WHOLE_MAX;
-
+ sbi->ll_contention_time = SBI_DEFAULT_CONTENTION_SECONDS;
+ sbi->ll_lockless_truncate_enable = SBI_DEFAULT_LOCKLESS_TRUNCATE_ENABLE;
INIT_LIST_HEAD(&sbi->ll_conn_chain);
INIT_LIST_HEAD(&sbi->ll_orphan_dentry_list);
ll_generate_random_uuid(uuid);
class_uuid_unparse(uuid, &sbi->ll_sb_uuid);
- CDEBUG(D_HA, "generated uuid: %s\n", sbi->ll_sb_uuid.uuid);
+ CDEBUG(D_CONFIG, "generated uuid: %s\n", sbi->ll_sb_uuid.uuid);
spin_lock(&ll_sb_lock);
list_add_tail(&sbi->ll_list, &ll_super_blocks);
spin_lock_init(&sbi->ll_rw_extents_info.pp_extents[i].pp_w_hist.oh_lock);
}
+ /* metadata statahead is enabled by default */
+ sbi->ll_sa_max = LL_SA_RPC_DEF;
+
RETURN(sbi);
}
}
static struct dentry_operations ll_d_root_ops = {
-#ifdef LUSTRE_KERNEL_VERSION
+#ifdef DCACHE_LUSTRE_INVALID
.d_compare = ll_dcompare,
#endif
};
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);
err = lprocfs_register_mountpoint(proc_lustre_fs_root, sb,
dt, md);
if (err < 0)
- CERROR("could not register mount in /proc/lustre");
+ CERROR("could not register mount in /proc/fs/lustre\n");
}
/* 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);
+ err = obd_connect(NULL, &md_conn, obd, &sbi->ll_sb_uuid, data, NULL);
if (err == -EBUSY) {
LCONSOLE_ERROR_MSG(0x14f, "An MDT (md %s) is performing "
"recovery, of which this client is not a "
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 |
+ OBD_CONNECT_SRVLOCK | OBD_CONNECT_TRUNCLOCK;
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
obd->obd_upcall.onu_upcall = ll_ocd_update;
data->ocd_brw_size = PTLRPC_MAX_BRW_PAGES << CFS_PAGE_SHIFT;
- err = obd_connect(NULL, &dt_conn, obd, &sbi->ll_sb_uuid, data);
+ err = obd_connect(NULL, &dt_conn, obd, &sbi->ll_sb_uuid, data, NULL);
if (err == -EBUSY) {
LCONSOLE_ERROR_MSG(0x150, "An OST (dt %s) is performing "
"recovery, of which this client is not a "
ll_async_page_slab_size =
size_round(sizeof(struct ll_async_page)) + err;
ll_async_page_slab = cfs_mem_cache_create("ll_async_page",
- ll_async_page_slab_size,
- 0, 0);
+ ll_async_page_slab_size,
+ 0, 0);
if (!ll_async_page_slab)
GOTO(out_dt_fid, err = -ENOMEM);
}
sbi->ll_root_fid = rootfid;
sb->s_op = &lustre_super_operations;
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
sb->s_export_op = &lustre_export_operations;
-#endif
/* make root inode
* XXX: move this to after cbd setup? */
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);
- /* making vm readahead 0 for 2.4.x. In the case of 2.6.x,
- backing dev info assigned to inode mapping is used for
- determining maximal readahead. */
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)) && \
- !defined(KERNEL_HAS_AS_MAX_READAHEAD)
- /* bug 2805 - set VM readahead to zero */
- vm_max_readahead = vm_min_readahead = 0;
-#endif
-
sb->s_root = d_alloc_root(root);
if (data != NULL)
OBD_FREE(data, sizeof(*data));
}
}
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-void lustre_throw_orphan_dentries(struct super_block *sb)
-{
- struct dentry *dentry, *next;
- struct ll_sb_info *sbi = ll_s2sbi(sb);
-
- /* Do this to get rid of orphaned dentries. That is not really trw. */
- list_for_each_entry_safe(dentry, next, &sbi->ll_orphan_dentry_list,
- d_hash) {
- CWARN("found orphan dentry %.*s (%p->%p) at unmount, dumping "
- "before and after shrink_dcache_parent\n",
- dentry->d_name.len, dentry->d_name.name, dentry, next);
- lustre_dump_dentry(dentry, 1);
- shrink_dcache_parent(dentry);
- lustre_dump_dentry(dentry, 1);
- }
-}
-#else
-#define lustre_throw_orphan_dentries(sb)
-#endif
-
#ifdef HAVE_EXPORT___IGET
static void prune_dir_dentries(struct inode *inode)
{
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);
obd_disconnect(sbi->ll_md_exp);
sbi->ll_md_exp = NULL;
- lustre_throw_orphan_dentries(sb);
-
EXIT;
}
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)
CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p)\n", inode->i_ino,
inode->i_generation, inode);
+ if (S_ISDIR(inode->i_mode)) {
+ /* these should have been cleared in ll_file_release */
+ LASSERT(lli->lli_sai == NULL);
+ LASSERT(lli->lli_opendir_key == NULL);
+ LASSERT(lli->lli_opendir_pid == 0);
+ }
+
ll_i2info(inode)->lli_flags &= ~LLIF_MDS_SIZE_LOCK;
md_change_cbdata(sbi->ll_md_exp, ll_inode2fid(inode),
null_if_equal, inode);
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);
RETURN(rc);
}
+static int ll_setattr_do_truncate(struct inode *inode, loff_t new_size)
+{
+ struct ll_sb_info *sbi = ll_i2sbi(inode);
+ struct ll_inode_info *lli = ll_i2info(inode);
+ struct lov_stripe_md *lsm = lli->lli_smd;
+ int rc;
+ ldlm_policy_data_t policy = { .l_extent = {new_size,
+ OBD_OBJECT_EOF } };
+ struct lustre_handle lockh = { 0 };
+ int local_lock = 0; /* 0 - no local lock;
+ * 1 - lock taken by lock_extent;
+ * 2 - by obd_match*/
+ int ast_flags;
+ int err;
+ ENTRY;
+
+ UNLOCK_INODE_MUTEX(inode);
+ UP_WRITE_I_ALLOC_SEM(inode);
+
+ if (sbi->ll_lockless_truncate_enable &&
+ (sbi->ll_lco.lco_flags & OBD_CONNECT_TRUNCLOCK)) {
+ ast_flags = LDLM_FL_BLOCK_GRANTED;
+ rc = obd_match(sbi->ll_dt_exp, lsm, LDLM_EXTENT,
+ &policy, LCK_PW, &ast_flags, inode, &lockh);
+ if (rc > 0) {
+ local_lock = 2;
+ rc = 0;
+ } else if (rc == 0) {
+ rc = ll_file_punch(inode, new_size, 1);
+ }
+ } else {
+ /* XXX when we fix the AST intents to pass the discard-range
+ * XXX extent, make ast_flags always LDLM_AST_DISCARD_DATA
+ * XXX here. */
+ ast_flags = (new_size == 0) ? LDLM_AST_DISCARD_DATA : 0;
+ rc = ll_extent_lock(NULL, inode, lsm, LCK_PW, &policy,
+ &lockh, ast_flags);
+ if (likely(rc == 0))
+ local_lock = 1;
+ }
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
+ DOWN_WRITE_I_ALLOC_SEM(inode);
+ LOCK_INODE_MUTEX(inode);
+#else
+ LOCK_INODE_MUTEX(inode);
+ DOWN_WRITE_I_ALLOC_SEM(inode);
+#endif
+ if (likely(rc == 0)) {
+ /* Only ll_inode_size_lock is taken at this level.
+ * lov_stripe_lock() is grabbed by ll_truncate() only over
+ * call to obd_adjust_kms(). If vmtruncate returns 0, then
+ * ll_truncate dropped ll_inode_size_lock() */
+ ll_inode_size_lock(inode, 0);
+ if (!local_lock) {
+ spin_lock(&lli->lli_lock);
+ lli->lli_flags |= LLIF_SRVLOCK;
+ spin_unlock(&lli->lli_lock);
+ }
+ rc = vmtruncate(inode, new_size);
+ if (!local_lock) {
+ spin_lock(&lli->lli_lock);
+ lli->lli_flags &= ~LLIF_SRVLOCK;
+ spin_unlock(&lli->lli_lock);
+ }
+ if (rc != 0) {
+ LASSERT(atomic_read(&lli->lli_size_sem.count) <= 0);
+ ll_inode_size_unlock(inode, 0);
+ }
+ }
+
+ if (local_lock) {
+ if (local_lock == 2)
+ err = obd_cancel(sbi->ll_dt_exp, lsm, LCK_PW, &lockh);
+ else
+ err = ll_extent_unlock(NULL, inode, lsm, LCK_PW, &lockh);
+ if (unlikely(err != 0)){
+ CERROR("extent unlock failed: err=%d,"
+ " unlock method =%d\n", err, local_lock);
+ if (rc == 0)
+ rc = err;
+ }
+ }
+ 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.
if (attr->ia_valid & (ATTR_MTIME | ATTR_CTIME))
CDEBUG(D_INODE, "setting mtime %lu, ctime %lu, now = %lu\n",
LTIME_S(attr->ia_mtime), LTIME_S(attr->ia_ctime),
- CURRENT_SECONDS);
+ cfs_time_current_sec());
/* NB: ATTR_SIZE will only be set after this point if the size
* resides on the MDS, ie, this file has no objects. */
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);
* last one is especially bad for racing o_append users on other
* nodes. */
if (ia_valid & ATTR_SIZE) {
- ldlm_policy_data_t policy = { .l_extent = {attr->ia_size,
- OBD_OBJECT_EOF } };
- struct lustre_handle lockh = { 0 };
- int err, ast_flags = 0;
- /* XXX when we fix the AST intents to pass the discard-range
- * XXX extent, make ast_flags always LDLM_AST_DISCARD_DATA
- * XXX here. */
- if (attr->ia_size == 0)
- ast_flags = LDLM_AST_DISCARD_DATA;
-
- UNLOCK_INODE_MUTEX(inode);
- UP_WRITE_I_ALLOC_SEM(inode);
- rc = ll_extent_lock(NULL, inode, lsm, LCK_PW, &policy, &lockh,
- ast_flags);
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
- DOWN_WRITE_I_ALLOC_SEM(inode);
- LOCK_INODE_MUTEX(inode);
-#else
- LOCK_INODE_MUTEX(inode);
- DOWN_WRITE_I_ALLOC_SEM(inode);
-#endif
- if (rc != 0)
- GOTO(out, rc);
-
- /* Only ll_inode_size_lock is taken at this level.
- * lov_stripe_lock() is grabbed by ll_truncate() only over
- * call to obd_adjust_kms(). If vmtruncate returns 0, then
- * ll_truncate dropped ll_inode_size_lock() */
- ll_inode_size_lock(inode, 0);
- rc = vmtruncate(inode, attr->ia_size);
- if (rc != 0) {
- LASSERT(atomic_read(&lli->lli_size_sem.count) <= 0);
- ll_inode_size_unlock(inode, 0);
- }
-
- err = ll_extent_unlock(NULL, inode, lsm, LCK_PW, &lockh);
- if (err) {
- CERROR("ll_extent_unlock failed: %d\n", err);
- if (!rc)
- rc = err;
- }
+ rc = ll_setattr_do_truncate(inode, attr->ia_size);
} else if (ia_valid & (ATTR_MTIME | ATTR_MTIME_SET)) {
obd_flag flags;
struct obd_info oinfo = { { { 0 } } };
}
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;
spin_unlock(&lli->lli_lock);
}
#endif
+ inode->i_ino = ll_fid_build_ino(sbi, &body->fid1);
+
if (body->valid & OBD_MD_FLATIME &&
body->atime > LTIME_S(inode->i_atime))
LTIME_S(inode->i_atime) = body->atime;
if (body->valid & OBD_MD_FLNLINK)
inode->i_nlink = body->nlink;
if (body->valid & OBD_MD_FLRDEV)
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
- inode->i_rdev = body->rdev;
-#else
inode->i_rdev = old_decode_dev(body->rdev);
-#endif
- if (body->valid & OBD_MD_FLSIZE) {
- if (ll_i2mdexp(inode)->exp_connect_flags & OBD_CONNECT_SOM) {
- if (lli->lli_flags & (LLIF_DONE_WRITING |
- LLIF_EPOCH_PENDING |
- LLIF_SOM_DIRTY))
- CWARN("ino %lu flags %lu still has size authority!"
- "do not trust the size got from MDS\n",
- inode->i_ino, lli->lli_flags);
- else {
- i_size_write(inode, body->size);
- lli->lli_flags |= LLIF_MDS_SIZE_LOCK;
- }
- } else {
- i_size_write(inode, body->size);
- }
-
- if (body->valid & OBD_MD_FLBLOCKS)
- inode->i_blocks = body->blocks;
- }
if (body->valid & OBD_MD_FLID) {
/* FID shouldn't be changed! */
LASSERT(fid_seq(&lli->lli_fid) != 0);
+ if (body->valid & OBD_MD_FLSIZE) {
+ if ((ll_i2mdexp(inode)->exp_connect_flags & OBD_CONNECT_SOM) &&
+ S_ISREG(inode->i_mode) && lli->lli_smd) {
+ struct lustre_handle lockh;
+ ldlm_mode_t mode;
+
+ /* As it is possible a blocking ast has been processed
+ * by this time, we need to check there is an UPDATE
+ * lock on the client and set LLIF_MDS_SIZE_LOCK holding
+ * it. */
+ mode = ll_take_md_lock(inode, MDS_INODELOCK_UPDATE,
+ &lockh);
+ if (mode) {
+ if (lli->lli_flags & (LLIF_DONE_WRITING |
+ LLIF_EPOCH_PENDING |
+ LLIF_SOM_DIRTY)) {
+ CERROR("ino %lu flags %lu still has "
+ "size authority! do not trust "
+ "the size got from MDS\n",
+ inode->i_ino, lli->lli_flags);
+ } else {
+ /* 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 {
+ /* Use old size assignment to avoid
+ * deadlock bz14138 & bz14326 */
+ inode->i_size = body->size;
+ }
+
+ if (body->valid & OBD_MD_FLBLOCKS)
+ inode->i_blocks = body->blocks;
+ }
+
if (body->valid & OBD_MD_FLMDSCAPA) {
LASSERT(md->mds_capa);
ll_add_capa(inode, md->mds_capa);
}
}
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
static struct backing_dev_info ll_backing_dev_info = {
.ra_pages = 0, /* No readahead */
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,12))
.memory_backed = 0, /* Does contribute to dirty memory */
#endif
};
-#endif
void ll_read_inode2(struct inode *inode, void *opaque)
{
} else {
inode->i_op = &ll_special_inode_operations;
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
init_special_inode(inode, inode->i_mode,
kdev_t_to_nr(inode->i_rdev));
/* initializing backing dev info. */
inode->i_mapping->backing_dev_info = &ll_backing_dev_info;
-#else
- init_special_inode(inode, inode->i_mode, inode->i_rdev);
-#endif
+
EXIT;
}
}
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);
- /*Now the ext3 will be packed directly back to client,
- *no need convert here*/
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);
[LLAP_ORIGIN_READAHEAD] = "ra",
[LLAP_ORIGIN_COMMIT_WRITE] = "cw",
[LLAP_ORIGIN_WRITEPAGE] = "wp",
+ [LLAP_ORIGIN_LOCKLESS_IO] = "ls"
};
struct ll_async_page *llite_pglist_next_llap(struct ll_sb_info *sbi,
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), '-');
op_data->op_capa2 = ll_mdscapa_get(i2);
} else {
fid_zero(&op_data->op_fid2);
+ op_data->op_capa2 = NULL;
}
op_data->op_name = name;
op_data->op_namelen = namelen;
op_data->op_mode = mode;
- op_data->op_mod_time = CURRENT_SECONDS;
+ op_data->op_mod_time = cfs_time_current_sec();
op_data->op_fsuid = current->fsuid;
op_data->op_fsgid = current->fsgid;
op_data->op_cap = current->cap_effective;
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;
-}