off, and we depend on the VM to clean up old inodes. This
dependency was during via the fix for bug 12181.
+Severity : normal
+Frequency : always
+Bugzilla : 12848
+Description: sanity.sh fail: test_52b
+Details : The ll_inode_to_ext_flags() has a glitch which makes MDS return
+ incorrect inode's flags to client.
+
--------------------------------------------------------------------------------
2007-04-19 Cluster File Systems, Inc. <info@clusterfs.com>
(flags & ~MDS_BFLAG_EXT_FLAGS);
}
-/* If MDS_BFLAG_EXT_FLAGS is set it means we requested EXT3_*_FL inode flags
- * and we pass these straight through. Otherwise we need to convert from
- * S_* flags to their EXT3_*_FL equivalents (see bug 9486). */
-static inline int ll_inode_to_ext_flags(int oflags, int iflags)
+/* If keep is set, we do not do anything with iflags, if it is not set, we
+ * assume that iflags are inode flags and we need to conver those to
+ * EXT3_*_FL flags (see bug 9486 and 12848) */
+static inline int ll_inode_to_ext_flags(int iflags, int keep)
{
- return (oflags & MDS_BFLAG_EXT_FLAGS) ? (oflags & ~MDS_BFLAG_EXT_FLAGS):
- (((iflags & S_SYNC) ? MDS_SYNC_FL : 0) |
+ return keep ? (iflags & ~MDS_BFLAG_EXT_FLAGS) :
+ (((iflags & S_SYNC) ? MDS_SYNC_FL : 0) |
((iflags & S_NOATIME) ? MDS_NOATIME_FL : 0) |
((iflags & S_APPEND) ? MDS_APPEND_FL : 0) |
#if defined(S_DIRSYNC)
#define OBD_FAIL_MDC_REVALIDATE_PAUSE 0x800
#define OBD_FAIL_MDC_ENQUEUE_PAUSE 0x801
+#define OBD_FAIL_MDC_OLD_EXT_FLAGS 0x802
#define OBD_FAIL_MGS 0x900
#define OBD_FAIL_MGS_ALL_REQUEST_NET 0x901
/* We want to return EXT3_*_FL flags to the caller via this
* ioctl. An older MDS may be sending S_* flags, fix it up. */
- flags = ll_inode_to_ext_flags(body->flags, body->flags);
+ flags = ll_inode_to_ext_flags(body->flags,
+ body->flags & MDS_BFLAG_EXT_FLAGS);
ptlrpc_req_finished (req);
RETURN(put_user(flags, (int *)arg));
b->capability = current->cap_effective;
b->valid = valid;
b->flags = flags | MDS_BFLAG_EXT_FLAGS;
+ /* skip MDS_BFLAG_EXT_FLAGS to verify the "client < 1.4.7" case
+ * refer to bug 12848.
+ */
+ if (OBD_FAIL_CHECK(OBD_FAIL_MDC_OLD_EXT_FLAGS))
+ b->flags &= ~MDS_BFLAG_EXT_FLAGS;
b->suppgid = data->suppgids[0];
b->fid1 = data->fid1;
b->blocks = inode->i_blocks;
b->uid = inode->i_uid;
b->gid = inode->i_gid;
- b->flags = ll_inode_to_ext_flags(b->flags, inode->i_flags);
+ b->flags = (b->flags & MDS_BFLAG_EXT_FLAGS) |
+ ll_inode_to_ext_flags(inode->i_flags,
+ !(b->flags & MDS_BFLAG_EXT_FLAGS));
b->rdev = inode->i_rdev;
/* Return the correct link count for orphan inodes */
b->nlink = mds_inode_is_orphan(inode) ? 0 : inode->i_nlink;
}
run_test 52b "immutable flag test (should return errors) ======="
+test_52c() { # 12848 simulating client < 1.4.7
+ [ -f $DIR/d52c/foo ] && chattr -i $DIR/d52b/foo
+ mkdir -p $DIR/d52c
+ touch $DIR/d52c/foo
+ # skip MDS_BFLAG_EXT_FLAGS in mdc_getattr_pack
+#define OBD_FAIL_MDC_OLD_EXT_FLAGS 0x802
+ sysctl -w lustre.fail_loc=0x802
+ chattr =i $DIR/d52c/foo || error
+ lsattr $DIR/d52c/foo | egrep -q "^-+i-+ $DIR/d52c/foo" || error
+ chattr -i $DIR/d52c/foo || error
+ sysctl -w lustre.fail_loc=0
+
+ rm -fr $DIR/d52c || error
+}
+run_test 52c "immutable flag test for client < 1.4.7 ======="
+
test_53() {
[ -z "$MDS" ] && echo "skipping $TESTNAME with remote MDS" && return