#define hlist_node list_head
#define HLIST_HEAD LIST_HEAD
#define INIT_HLIST_HEAD INIT_LIST_HEAD
-#define INIT_HLIST_NODE(p) (p)
#define hlist_del_init list_del_init
#define hlist_add_head list_add
+#endif
+#ifndef INIT_HLIST_NODE
+#define INIT_HLIST_NODE(p) ((p)->next = NULL, (p)->prev = NULL)
+#endif
+#ifndef hlist_for_each
#define hlist_for_each list_for_each
+#endif
+#ifndef hlist_for_each_safe
#define hlist_for_each_safe list_for_each_safe
#endif
#define KDEVT_INIT(val) (val)
*/
#ifndef _LUSTRE_DISK_H
#define _LUSTRE_DISK_H_
-#define LAST_RCVD "last_rcvd"
-#define LOV_OBJID "lov_objid"
-#define OBD_COMPAT_OST 0x00000002 /* this is an OST (temporary) */
-#define OBD_COMPAT_MDT 0x00000004 /* this is an MDT (temporary) */
+#include <linux/types.h>
-#define OBD_ROCOMPAT_LOVOBJID 0x00000001 /* MDS handles LOV_OBJID file */
-#define OBD_ROCOMPAT_CROW 0x00000002 /* OST will CROW create objects */
+#include <lnet/types.h>
-#define OBD_INCOMPAT_GROUPS 0x00000001 /* OST handles group subdirs */
-#define OBD_INCOMPAT_OST 0x00000002 /* this is an OST (permanent) */
-#define OBD_INCOMPAT_MDT 0x00000004 /* this is an MDT (permanent) */
+/****************** last_rcvd file *********************/
+
+#define LAST_RCVD "last_rcvd"
+#define LOV_OBJID "lov_objid"
#define LR_SERVER_SIZE 512
#define LR_CLIENT_START 8192
* 2^n * PAGE_SIZE * 8 for the number of bits that fit an order-n allocation. */
#define LR_MAX_CLIENTS (PAGE_SIZE * 8)
+#define OBD_COMPAT_OST 0x00000002 /* this is an OST (temporary) */
+#define OBD_COMPAT_MDT 0x00000004 /* this is an MDT (temporary) */
+
+#define OBD_ROCOMPAT_LOVOBJID 0x00000001 /* MDS handles LOV_OBJID file */
+#define OBD_ROCOMPAT_CROW 0x00000002 /* OST will CROW create objects */
+
+#define OBD_INCOMPAT_GROUPS 0x00000001 /* OST handles group subdirs */
+#define OBD_INCOMPAT_OST 0x00000002 /* this is an OST (permanent) */
+#define OBD_INCOMPAT_MDT 0x00000004 /* this is an MDT (permanent) */
+
/* Data stored per client in the last_rcvd file. In le32 order. */
struct lsd_client_data {
__u8 lcd_uuid[40]; /* client UUID */
#define XATTR_LUSTRE_MDS_LOV_EA "lov"
+struct lustre_dquot;
struct fsfilt_operations {
struct list_head fs_list;
struct module *fs_owner;
__u32 os_bsize;
__u32 os_namelen;
__u64 os_maxbytes;
- __u32 os_state;
+ __u32 os_state; /* positive error code on server */
__u32 os_spare1;
__u32 os_spare2;
__u32 os_spare3;
imp_deactive:1;
__u32 imp_connect_op;
struct obd_connect_data imp_connect_data;
+ __u64 imp_connect_flags_orig;
};
#define IMP_CROW_ABLE(imp) \
GOTO(out_ldlm, rc);
ocd = &imp->imp_connect_data;
- if (data)
+ if (data) {
*ocd = *data;
+ imp->imp_connect_flags_orig = data->ocd_connect_flags;
+ }
rc = ptlrpc_connect_import(imp, NULL);
if (rc != 0) {
dst->o_generation = lli->lli_st_generation;
newvalid |= OBD_MD_FLGENER;
}
+ if (valid & OBD_MD_FLFID) {
+ dst->o_fid = st->st_ino;
+ newvalid |= OBD_MD_FLFID;
+ }
dst->o_valid |= newvalid;
}
struct inode *inode;
struct llu_inode_info *lli;
struct intnl_stat st = {
- st_dev: 0,
+ .st_dev = 0,
#ifndef AUTOMOUNT_FILE_NAME
- st_mode: fid->f_type & S_IFMT,
+ .st_mode = fid->f_type & S_IFMT,
#else
- st_mode: fid->f_type /* all of the bits! */
+ .st_mode = fid->f_type /* all of the bits! */
#endif
- st_uid: geteuid(),
- st_gid: getegid(),
+ .st_uid = geteuid(),
+ .st_gid = getegid(),
};
OBD_ALLOC(lli, sizeof(*lli));
lli->lli_sysio_fid.fid_data = &lli->lli_fid;
lli->lli_sysio_fid.fid_len = sizeof(lli->lli_fid);
-
- memcpy(&lli->lli_fid, fid, sizeof(*fid));
+ lli->lli_fid = *fid;
/* file identifier is needed by functions like _sysio_i_find() */
inode = _sysio_i_new(fs, &lli->lli_sysio_fid,
static
int lustre_check_acl(struct inode *inode, int mask)
{
+#ifdef CONFIG_FS_POSIX_ACL
struct ll_inode_info *lli = ll_i2info(inode);
struct posix_acl *acl;
int rc;
posix_acl_release(acl);
RETURN(rc);
+#else
+ return 0;
+#endif
}
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10))
extern struct proc_dir_entry *proc_lustre_fs_root;
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-# define hlist_del_init list_del_init
-#endif
-
static inline struct inode *ll_info2i(struct ll_inode_info *lli)
{
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
data->ocd_connect_flags |= OBD_CONNECT_RDONLY;
if (sbi->ll_flags & LL_SBI_USER_XATTR)
data->ocd_connect_flags |= OBD_CONNECT_USER_XATTR;
- if (sbi->ll_flags & LL_SBI_ACL)
- data->ocd_connect_flags |= OBD_CONNECT_ACL;
+ data->ocd_connect_flags |= OBD_CONNECT_ACL;
if (sbi->ll_flags & LL_SBI_FLOCK) {
sbi->ll_fop = &ll_file_operations_flock;
sbi->ll_flags &= ~LL_SBI_USER_XATTR;
}
- if (((sbi->ll_flags & LL_SBI_ACL) == 0) !=
- ((data->ocd_connect_flags & OBD_CONNECT_ACL) == 0)) {
- CERROR("Server return unexpected ACL flags\n");
- GOTO(out_mdc, err = -EBADE);
- }
+ if (data->ocd_connect_flags & OBD_CONNECT_ACL)
+ sbi->ll_flags |= LL_SBI_ACL;
+ else
+ sbi->ll_flags &= ~LL_SBI_ACL;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0))
/* We set sb->s_dev equal on all lustre clients in order to support
/* make root inode
* XXX: move this to after cbd setup? */
err = mdc_getattr(sbi->ll_mdc_exp, &rootfid,
- OBD_MD_FLGETATTR | OBD_MD_FLBLOCKS | OBD_MD_FLACL,
+ OBD_MD_FLGETATTR | OBD_MD_FLBLOCKS |
+ (sbi->ll_flags & LL_SBI_ACL ? OBD_MD_FLACL : 0),
0, &request);
if (err) {
CERROR("mdc_getattr failed for root: rc = %d\n", err);
}
tmp = ll_set_opt("acl", this_char, LL_SBI_ACL);
if (tmp) {
- *flags |= tmp;
+ /* Ignore deprecated mount option. The client will
+ * always try to mount with ACL support, whether this
+ * is used depends on whether server supports it. */
continue;
}
tmp = ll_set_opt("noacl", this_char, LL_SBI_ACL);
if (tmp) {
- *flags &= ~tmp;
continue;
}
}
if (rc)
GOTO(out_cleanup, rc);
- if (lmd->lmd_flags & LMD_FLG_ACL) {
- OBD_ALLOC(ocd, sizeof(*ocd));
- if (ocd == NULL)
- GOTO(out_cleanup, rc = -ENOMEM);
- ocd->ocd_connect_flags |= OBD_CONNECT_ACL;
- }
+ ocd->ocd_connect_flags |= OBD_CONNECT_ACL;
rc = obd_connect(&mdc_conn, obd, &mdc_uuid, ocd);
if (rc) {
sbi->ll_flags |= LL_SBI_FLOCK;
if (lmd->lmd_flags & LMD_FLG_USER_XATTR)
sbi->ll_flags |= LL_SBI_USER_XATTR;
- if (lmd->lmd_flags & LMD_FLG_ACL)
- sbi->ll_flags |= LL_SBI_ACL;
/* generate a string unique to this super, let's try
the address of the super itself.*/
lli->lli_symlink_name = NULL;
}
+#ifdef CONFIG_FS_POSIX_ACL
if (lli->lli_posix_acl) {
LASSERT(atomic_read(&lli->lli_posix_acl->a_refcount) == 1);
posix_acl_release(lli->lli_posix_acl);
lli->lli_posix_acl = NULL;
}
+#endif
lli->lli_inode_magic = LLI_INODE_DEAD;
inode->i_sb->s_blocksize);
}
+#ifdef CONFIG_FS_POSIX_ACL
LASSERT(!md->posix_acl || (body->valid & OBD_MD_FLACL));
if (body->valid & OBD_MD_FLACL) {
spin_lock(&lli->lli_lock);
lli->lli_posix_acl = md->posix_acl;
spin_unlock(&lli->lli_lock);
}
+#endif
if (body->valid & OBD_MD_FLID)
inode->i_ino = body->ino;
.o_notify = lov_notify,
};
-static quota_interface_t *quota_interface = NULL;
+static quota_interface_t *quota_interface;
extern quota_interface_t lov_quota_interface;
int __init lov_init(void)
quota_interface = PORTAL_SYMBOL_GET(lov_quota_interface);
init_obd_quota_ops(quota_interface, &lov_obd_ops);
-
+
rc = class_register_type(&lov_obd_ops, lvars.module_vars,
OBD_LOV_DEVICENAME);
if (rc && quota_interface)
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
#include <linux/iobuf.h>
#endif
+#include <linux/lustre_compat25.h>
#ifdef EXT3_MULTIBLOCK_ALLOCATOR
#include <linux/ext3_extents.h>
/* make sure _something_ gets set - so new inode
* goes to disk (probably won't work over XFS */
if (!(iattr->ia_valid & (ATTR_MODE | ATTR_MTIME | ATTR_CTIME))){
- iattr->ia_valid |= ATTR_MODE;
- iattr->ia_mode = inode->i_mode;
+ iattr->ia_valid |= ATTR_MTIME;
+ iattr->ia_mtime = inode->i_mtime;
}
}
/* Don't allow setattr to change file type */
- iattr->ia_mode = (inode->i_mode & S_IFMT)|(iattr->ia_mode & ~S_IFMT);
+ if (iattr->ia_valid & ATTR_MODE)
+ iattr->ia_mode = (inode->i_mode & S_IFMT) |
+ (iattr->ia_mode & ~S_IFMT);
/* We set these flags on the client, but have already checked perms
* so don't confuse inode_change_ok. */
rec->cr_replayfid.generation, rec->cr_replayfid.id);
}
+#ifdef CONFIG_FS_POSIX_ACL
static
int mdc_unpack_acl(struct obd_export *exp, struct ptlrpc_request *req,
struct lustre_md *md, unsigned int offset)
md->posix_acl = acl;
return 0;
}
+#else
+#define mdc_unpack_acl(exp, req, md, offset) 0
+#endif
int mdc_req2lustre_md(struct ptlrpc_request *req, int offset,
struct obd_export *exp,
if (md->lsm)
obd_free_memmd(exp, &md->lsm);
+#ifdef CONFIG_FS_POSIX_ACL
if (md->posix_acl) {
posix_acl_release(md->posix_acl);
md->posix_acl = NULL;
}
+#endif
}
static void mdc_commit_open(struct ptlrpc_request *req)
.o_llog_finish = mdc_llog_finish,
};
-static quota_interface_t *quota_interface = NULL;
+static quota_interface_t *quota_interface;
extern quota_interface_t mdc_quota_interface;
int __init mdc_init(void)
int rc;
struct lprocfs_static_vars lvars;
lprocfs_init_vars(mdc, &lvars);
-
+
quota_interface = PORTAL_SYMBOL_GET(mdc_quota_interface);
init_obd_quota_ops(quota_interface, &mdc_obd_ops);
-
+
rc = class_register_type(&mdc_obd_ops, lvars.module_vars,
LUSTRE_MDC_NAME);
if (rc && quota_interface)
if (data != NULL) {
data->ocd_connect_flags &= MDS_CONNECT_SUPPORTED;
+ if (!obd->u.mds.mds_fl_acl)
+ data->ocd_connect_flags &= ~OBD_CONNECT_ACL;
+
if (!obd->u.mds.mds_fl_user_xattr)
data->ocd_connect_flags &= ~OBD_CONNECT_USER_XATTR;
exp->exp_connect_flags = data->ocd_connect_flags;
}
- if ((obd->u.mds.mds_fl_acl == 0) !=
+ if (obd->u.mds.mds_fl_acl &&
((exp->exp_connect_flags & OBD_CONNECT_ACL) == 0)) {
- CWARN("%s require ACL support but %s doesn't\n",
- obd->u.mds.mds_fl_acl ? "MDS" : "client",
- obd->u.mds.mds_fl_acl ? "client" : "MDS");
+ CWARN("%s: MDS requires ACL support but client does not\n",
+ obd->obd_name);
GOTO(out, rc = -EBADE);
}
OBD_ALLOC(mcd, sizeof(*mcd));
- if (!mcd) {
- CERROR("mds: out of memory for client data\n");
+ if (!mcd)
GOTO(out, rc = -ENOMEM);
- }
memcpy(mcd->mcd_uuid, cluuid, sizeof(mcd->mcd_uuid));
med->med_mcd = mcd;
RETURN(rc);
}
+#ifdef CONFIG_FS_POSIX_ACL
static
int mds_pack_posix_acl(struct inode *inode, struct lustre_msg *repmsg,
struct mds_body *repbody, int repoff)
repbody->valid |= OBD_MD_FLACL;
return 0;
}
+#else
+#define mds_pack_posix_acl(inode, repmsg, repbody, repoff) 0
+#endif
int mds_pack_acl(struct mds_export_data *med, struct inode *inode,
struct lustre_msg *repmsg, struct mds_body *repbody,
if (rc)
RETURN(rc);
+#ifdef CONFIG_FS_POSIX_ACL
if ((req->rq_export->exp_connect_flags & OBD_CONNECT_ACL) &&
(reqbody->valid & OBD_MD_FLACL)) {
rc = mds_pack_acl(&req->rq_export->exp_mds_data,
if (body->aclsize)
reply_off++;
}
+#endif
RETURN(rc);
}
inode->i_size + 1, body->eadatasize);
}
+#ifdef CONFIG_FS_POSIX_ACL
if ((req->rq_export->exp_connect_flags & OBD_CONNECT_ACL) &&
(body->valid & OBD_MD_FLACL)) {
struct dentry de = { .d_inode = inode };
}
bufcount++;
}
+#endif
if (OBD_FAIL_CHECK(OBD_FAIL_MDS_GETATTR_PACK)) {
CERROR("failed MDS_GETATTR_PACK test\n");
}
static
-void fsoptions_to_mds_flags(struct mds_obd *mds, const char *options)
+void fsoptions_to_mds_flags(struct mds_obd *mds, char *options)
{
- const char *p = options;
+ char *p = options;
while (*options) {
+ int len;
+
while (*p && *p != ',')
p++;
- if ((p - options == sizeof("user_xattr") - 1) &&
- !memcmp(options, "user_xattr", sizeof("user_xattr") - 1))
+ len = p - options;
+ if (len == sizeof("user_xattr") - 1 &&
+ memcmp(options, "user_xattr", len) == 0) {
mds->mds_fl_user_xattr = 1;
- else if ((p - options == sizeof("acl") - 1) &&
- !memcmp(options, "acl", sizeof("acl") - 1))
+ } else if (len == sizeof("acl") - 1 &&
+ memcmp(options, "acl", len) == 0) {
+#ifdef CONFIG_FS_POSIX_ACL
mds->mds_fl_acl = 1;
+#else
+ CWARN("ignoring unsupported acl mount option\n");
+ memmove(options, p, strlen(p) + 1);
+#endif
+ }
options = ++p;
}
/* here we use "iopen_nopriv" hardcoded, because it affects MDS utility
* and the rest of options are passed by mount options. Probably this
* should be moved to somewhere else like startup scripts or lconf. */
- sprintf(options, "iopen_nopriv");
+ strcpy(options, "iopen_nopriv");
if (LUSTRE_CFG_BUFLEN(lcfg, 4) > 0 && lustre_cfg_buf(lcfg, 4)) {
sprintf(options + strlen(options), ",%s",
if ((req->rq_export->exp_connect_flags & OBD_CONNECT_ACL) &&
(it->opc & (IT_OPEN | IT_GETATTR | IT_LOOKUP)))
+ /* we should never allow OBD_CONNECT_ACL if not configured */
repsize[repbufcnt++] = LUSTRE_POSIX_ACL_MAX_SIZE;
else if (it->opc & IT_UNLINK)
repsize[repbufcnt++] = mds->mds_max_cookiesize;
.o_health_check = mdt_health_check,
};
-quota_interface_t *quota_interface = NULL;
-extern quota_interface_t mds_quota_interface;
-
static int __init mds_init(void)
{
int rc;
};
#endif
-static quota_interface_t *quota_interface = NULL;
+static quota_interface_t *quota_interface;
extern quota_interface_t osc_quota_interface;
int __init osc_init(void)
osfs = lustre_msg_buf(req->rq_repmsg, 0, sizeof(*osfs));
req->rq_status = obd_statfs(req->rq_export->exp_obd, osfs, jiffies-HZ);
+ if (OBD_FAIL_CHECK_ONCE(OBD_FAIL_OST_ENOSPC))
+ osfs->os_bfree = 64;
if (req->rq_status != 0)
CERROR("ost: statfs failed: rc %d\n", req->rq_status);
"\t-o: filesystem mount options:\n"
"\t\tflock/noflock: enable/disable flock support\n"
"\t\tuser_xattr/nouser_xattr: enable/disable user extended attributes\n"
- "\t\t{no}acl: enable/disable ACL support\n"
);
exit(out != stdout);
}