[LU-6952] Mount options parsing problem Created: 04/Aug/15  Updated: 04/Aug/17  Resolved: 16/May/17

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.8.0
Fix Version/s: Lustre 2.10.0

Type: Bug Priority: Major
Reporter: Rahul Deshmukh (Inactive) Assignee: Hongchao Zhang
Resolution: Fixed Votes: 0
Labels: cea, patch

Issue Links:
Duplicate
Related
is related to LU-6662 mkfs should allow use of errors=panic Resolved
Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

The code which parse the mount option (lustre/utils/mount_lustre.c: parse_ldd()) expect that the default mount options come first and then the user given options. But actually the default options are appended after the user given option. Because of this user given options are cleared.

Following code fix this bug:

diff --git a/lustre/utils/mount_lustre.c b/lustre/utils/mount_lustre.c
index e4cc51a..44d092c 100644
--- a/lustre/utils/mount_lustre.c
+++ b/lustre/utils/mount_lustre.c
@@ -385,6 +385,7 @@ static int parse_ldd(char *source, struct mount_opts *mop, char *options)
 {
        struct lustre_disk_data *ldd = &mop->mo_ldd;
        char *cur, *start;
+       char *temp_options;
        int rc;
 
        rc = osd_is_lustre(source, &ldd->ldd_mount_type);
@@ -438,12 +439,21 @@ static int parse_ldd(char *source, struct mount_opts *mop, char *options)
                        ldd->ldd_flags |= LDD_F_WRITECONF;
                }
        }
+
+       /* This is to make sure default options go first */
+       temp_options = strdup(options);
+       if (temp_options == NULL) {
+               fprintf(stderr, "can't allocate memory for temp_options\n");
+               return ENOMEM;
+       }
+       strcpy(options, ldd->ldd_mount_opts);
+       append_option(options, temp_options);
+       free(temp_options);
+
        /* backend osd type */
        append_option(options, "osd=");
        strcat(options, mt_type(ldd->ldd_mount_type));
 
-       append_option(options, ldd->ldd_mount_opts);
-
        if (!mop->mo_have_mgsnid) {
                /* Only use disk data if mount -o mgsnode=nid wasn't
                 * specified */



 Comments   
Comment by Andreas Dilger [ 04/Aug/15 ]

Is there a reason why you posted the patch as a comment here instead of pushing a patch to Gerrit?

Comment by Rahul Deshmukh (Inactive) [ 05/Aug/15 ]

Apology for any confusion. There is no perticular reason for this. Will post the patch to gerrit.

Comment by Andreas Dilger [ 06/Aug/15 ]

It looks like the LU-6662 bug is very similar.

Comment by Joseph Gmitter (Inactive) [ 06/Aug/15 ]

Hongchao,
This looks similar to your patch, can you look at it?
Thanks.
Joe

Comment by Gerrit Updater [ 07/Aug/15 ]

pratik.shinde (pratik.shinde@seagate.com) uploaded a new patch: http://review.whamcloud.com/15906
Subject: LU-6952 mount: Mount options parsing problem
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 0ebfd4c44c427628fd4928328582ad329c347c84

Comment by Andreas Dilger [ 05/Dec/15 ]

Can you please check if http://review.whamcloud.com/15870 will also resolve this problem?

Comment by Hongchao Zhang [ 28/Jan/16 ]

the patch http://review.whamcloud.com/15870 in LU-6992 can't resolve this problem, and I have refreshed the patch.

Comment by Hongchao Zhang [ 22/Jul/16 ]

http://review.whamcloud.com/15906 has been updated

Comment by Gerrit Updater [ 16/May/17 ]

Oleg Drokin (oleg.drokin@intel.com) merged in patch https://review.whamcloud.com/15906/
Subject: LU-6952 mount: Mount options parsing problem
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: b27652cb440f2bea59db254e955403484c6c1d3a

Comment by Peter Jones [ 16/May/17 ]

Landed for 2.10

Generated at Sat Feb 10 02:04:42 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.