* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*
- * Copyright (c) 2011, 2013, Intel Corporation.
+ * Copyright (c) 2011, 2014, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
#define DEBUG_SUBSYSTEM S_LLITE
#include <obd_support.h>
-#include <lustre_lite.h>
#include <lustre_dlm.h>
#include <lustre_ver.h>
#include <lustre_eacl.h>
(strncmp(name, XATTR_LUSTRE_PREFIX,
sizeof(XATTR_LUSTRE_PREFIX) - 1) == 0 &&
strcmp(name + sizeof(XATTR_LUSTRE_PREFIX) - 1, "lov") == 0)) {
- struct lov_user_md *lump = (struct lov_user_md *)value;
- int rc = 0;
+ struct lov_user_md *lump = (struct lov_user_md *)value;
+ int rc = 0;
/* Attributes that are saved via getxattr will always have
* the stripe_offset as 0. Instead, the MDS should be
if (lump != NULL && S_ISREG(inode->i_mode)) {
struct file f;
__u64 it_flags = FMODE_WRITE;
- int lum_size = (lump->lmm_magic == LOV_USER_MAGIC_V1) ?
- sizeof(*lump) : sizeof(struct lov_user_md_v3);
+ int lum_size;
+
+ lum_size = ll_lov_user_md_size(lump);
+ if (lum_size < 0 || size < lum_size)
+ return 0; /* b=10667: ignore error */
memset(&f, 0, sizeof(f)); /* f.f_flags is used below */
f.f_dentry = dentry;
rc = ll_lov_setstripe_ea_info(inode, &f, it_flags, lump,
lum_size);
- /* b10667: rc always be 0 here for now */
+ /* b=10667: rc always be 0 here for now */
rc = 0;
} else if (S_ISDIR(inode->i_mode)) {
rc = ll_dir_setstripe(inode, lump, 0);
OBD_MD_FLXATTRRM);
}
-static
int ll_getxattr_common(struct inode *inode, const char *name,
void *buffer, size_t size, __u64 valid)
{