CDEBUG(D_CONFIG, "Parsing opts %s\n", options);
- while (*s1) {
- CDEBUG(D_SUPER, "next opt=%s\n", s1);
- tmp = ll_set_opt("nolock", s1, LL_SBI_NOLCK);
- if (tmp) {
- *flags |= tmp;
- goto next;
- }
- tmp = ll_set_opt("flock", s1, LL_SBI_FLOCK);
- if (tmp) {
- *flags |= tmp;
- goto next;
- }
- tmp = ll_set_opt("localflock", s1, LL_SBI_LOCALFLOCK);
- if (tmp) {
- *flags |= tmp;
- goto next;
- }
- tmp = ll_set_opt("noflock", s1, LL_SBI_FLOCK|LL_SBI_LOCALFLOCK);
- if (tmp) {
- *flags &= ~tmp;
- goto next;
- }
- tmp = ll_set_opt("user_xattr", s1, LL_SBI_USER_XATTR);
- if (tmp) {
- *flags |= tmp;
- goto next;
- }
- tmp = ll_set_opt("nouser_xattr", s1, LL_SBI_USER_XATTR);
- if (tmp) {
- *flags &= ~tmp;
- goto next;
- }
+ while (*s1) {
+ CDEBUG(D_SUPER, "next opt=%s\n", s1);
+ tmp = ll_set_opt("nolock", s1, LL_SBI_NOLCK);
+ if (tmp) {
+ *flags |= tmp;
+ goto next;
+ }
+ tmp = ll_set_opt("flock", s1, LL_SBI_FLOCK);
+ if (tmp) {
+ *flags = (*flags & ~LL_SBI_LOCALFLOCK) | tmp;
+ goto next;
+ }
+ tmp = ll_set_opt("localflock", s1, LL_SBI_LOCALFLOCK);
+ if (tmp) {
+ *flags = (*flags & ~LL_SBI_FLOCK) | tmp;
+ goto next;
+ }
+ tmp = ll_set_opt("noflock", s1, LL_SBI_FLOCK|LL_SBI_LOCALFLOCK);
+ if (tmp) {
+ *flags &= ~tmp;
+ goto next;
+ }
+ tmp = ll_set_opt("user_xattr", s1, LL_SBI_USER_XATTR);
+ if (tmp) {
+ *flags |= tmp;
+ goto next;
+ }
+ tmp = ll_set_opt("nouser_xattr", s1, LL_SBI_USER_XATTR);
+ if (tmp) {
+ *flags &= ~tmp;
+ goto next;
+ }
tmp = ll_set_opt("context", s1, 1);
if (tmp)
goto next;
int ll_show_options(struct seq_file *seq, struct vfsmount *vfs)
#endif
{
- struct ll_sb_info *sbi;
+ struct ll_sb_info *sbi;
#ifdef HAVE_SUPEROPS_USE_DENTRY
LASSERT((seq != NULL) && (dentry != NULL));
sbi = ll_s2sbi(vfs->mnt_sb);
#endif
- if (sbi->ll_flags & LL_SBI_NOLCK)
- seq_puts(seq, ",nolock");
-
- if (sbi->ll_flags & LL_SBI_FLOCK)
- seq_puts(seq, ",flock");
+ if (sbi->ll_flags & LL_SBI_NOLCK)
+ seq_puts(seq, ",nolock");
- if (sbi->ll_flags & LL_SBI_LOCALFLOCK)
- seq_puts(seq, ",localflock");
+ /* "flock" is the default since 2.13, but it wasn't for many years,
+ * so it is still useful to print this to show it is enabled.
+ * Start to print "noflock" so it is now clear when flock is disabled.
+ */
+ if (sbi->ll_flags & LL_SBI_FLOCK)
+ seq_puts(seq, ",flock");
+ else if (sbi->ll_flags & LL_SBI_LOCALFLOCK)
+ seq_puts(seq, ",localflock");
+ else
+ seq_puts(seq, ",noflock");
- if (sbi->ll_flags & LL_SBI_USER_XATTR)
- seq_puts(seq, ",user_xattr");
+ if (sbi->ll_flags & LL_SBI_USER_XATTR)
+ seq_puts(seq, ",user_xattr");
- if (sbi->ll_flags & LL_SBI_LAZYSTATFS)
- seq_puts(seq, ",lazystatfs");
+ if (sbi->ll_flags & LL_SBI_LAZYSTATFS)
+ seq_puts(seq, ",lazystatfs");
if (sbi->ll_flags & LL_SBI_USER_FID2PATH)
seq_puts(seq, ",user_fid2path");
if (sbi->ll_flags & LL_SBI_ALWAYS_PING)
seq_puts(seq, ",always_ping");
- RETURN(0);
+ RETURN(0);
}
/**
}
mount_client() {
- local MOUNTPATH=$1
- echo "mount $FSNAME on ${MOUNTPATH}....."
- zconf_mount $(hostname) $MOUNTPATH || return 96
-}
+ local mountpath=$1
+ local mountopt="$2"
-remount_client() {
- local mountopt="remount,$1"
- local MOUNTPATH=$2
- echo "remount '$1' lustre on ${MOUNTPATH}....."
- zconf_mount $(hostname) $MOUNTPATH "$mountopt" || return 96
+ echo "mount $FSNAME ${mountopt:+with opts $mountopt} on $mountpath....."
+ zconf_mount $HOSTNAME $mountpath $mountopt || return 96
}
umount_client() {
mount_client $MOUNT || error "mount_client $MOUNT failed"
check_mount || error "check_mount failed"
rm -f $DIR/$tfile || error "remove $DIR/$tfile failed."
- remount_client ro $MOUNT || error "remount_client with ro failed"
+ mount_client $MOUNT remount,ro || error "remount client with ro failed"
touch $DIR/$tfile && error "$DIR/$tfile created incorrectly"
[ -e $DIR/$tfile ] && error "$DIR/$tfile exists incorrectly"
- remount_client rw $MOUNT || error "remount_client with rw failed"
+ mount_client $MOUNT remount,rw || error "remount client with rw failed"
touch $DIR/$tfile || error "touch $DIR/$tfile failed"
MCNT=$(grep -c $MOUNT' ' /etc/mtab)
[ "$MCNT" -ne 1 ] && error "$MOUNT in /etc/mtab $MCNT times"
for ((x = 1; x <= 400; x++)); do
mountopt="$mountopt,user_xattr"
done
- remount_client $mountopt $MOUNT 2>&1 | grep "too long" ||
+ mount_client $MOUNT remount,$mountopt 2>&1 | grep "too long" ||
error "Buffer overflow check failed"
cleanup || error "cleanup failed"
}
}
run_test 103 "rename filesystem name"
-test_104() { # LU-6952
+test_104a() { # LU-6952
local mds_mountopts=$MDS_MOUNT_OPTS
local ost_mountopts=$OST_MOUNT_OPTS
local mds_mountfsopts=$MDS_MOUNT_FS_OPTS
OST_MOUNT_OPTS=$ost_mountopts
MDS_MOUNT_FS_OPTS=$mds_mountfsopts
}
-run_test 104 "Make sure user defined options are reflected in mount"
+run_test 104a "Make sure user defined options are reflected in mount"
+
+test_104b() { # LU-12859
+ mount_client $MOUNT3 flock,localflock
+ stack_trap "umount_client $MOUNT3" EXIT
+ mount | grep "$MOUNT3 .*,flock" && error "flock is still set"
+ mount | grep "$MOUNT3 .*,localflock" || error "localflock is not set"
+ umount_client $MOUNT3
+ mount_client $MOUNT3 localflock,flock
+ mount | grep "$MOUNT3 .*,localflock" && error "localflock is still set"
+ mount | grep "$MOUNT3 .*,flock" || error "flock is not set"
+ umount_client $MOUNT3
+ mount_client $MOUNT3 localflock,flock,noflock
+ flock_is_enabled $MOUNT3 && error "some flock is still enabled" || true
+}
+run_test 104b "Mount uses last flock argument"
error_and_umount() {
umount $TMP/$tdir