[LU-6491] Confusing results for too long fsname Created: 24/Apr/15  Updated: 28/May/15  Resolved: 28/May/15

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

Type: Bug Priority: Trivial
Reporter: Wang Shilong (Inactive) Assignee: Emoly Liu
Resolution: Fixed Votes: 0
Labels: None

Epic/Theme: patch
Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

If users passed a fsname longer than 9 bytes, caller
will handle it as ENOMEM which output following results:

error: conf_param: Cannot allocate memory

which is really unfriendly for common users.



 Comments   
Comment by Wang Shilong (Inactive) [ 24/Apr/15 ]

I missed to migrate my google account for gerrit, but i think here should fix it.
diff --git a/lustre/mgs/mgs_llog.c b/lustre/mgs/mgs_llog.c
index d804de4..2f36696 100644
— a/lustre/mgs/mgs_llog.c
+++ b/lustre/mgs/mgs_llog.c
@@ -334,12 +334,12 @@ static struct fs_db *mgs_new_fsdb(const struct lu_env *env,

if (strlen(fsname) >= sizeof(fsdb->fsdb_name))

{ CERROR("fsname %s is too long\n", fsname); - RETURN(NULL); + RETURN(ERR_PTR(-EINVAL)); }

OBD_ALLOC_PTR(fsdb);
if (!fsdb)

  • RETURN(NULL);
    + RETURN(ERR_PTR(-ENOMEM));

strcpy(fsdb->fsdb_name, fsname);
mutex_init(&fsdb->fsdb_mutex);
@@ -380,7 +380,7 @@ err:
name_destroy(&fsdb->fsdb_clilov);
name_destroy(&fsdb->fsdb_clilmv);
OBD_FREE_PTR(fsdb);

  • RETURN(NULL);
    + RETURN(ERR_PTR(rc));
    }

static void mgs_free_fsdb(struct mgs_device *mgs, struct fs_db *fsdb)
@@ -443,11 +443,11 @@ int mgs_find_or_make_fsdb(const struct lu_env *env,
CDEBUG(D_MGS, "Creating new db\n");
fsdb = mgs_new_fsdb(env, mgs, name);
/* lock fsdb_mutex until the db is loaded from llogs */

  • if (fsdb)
    + if (!IS_ERR(fsdb))
    mutex_lock(&fsdb->fsdb_mutex);
    mutex_unlock(&mgs->mgs_mutex);
  • if (!fsdb)
  • RETURN(-ENOMEM);
    + if (IS_ERR(fsdb))
    + RETURN(PTR_ERR(fsdb));

if (!test_bit(FSDB_MGS_SELF, &fsdb->fsdb_flags)) {
/* populate the db from the client llog */

Comment by Gerrit Updater [ 24/Apr/15 ]

Shilong Wang (wshilong@ddn.com) uploaded a new patch: http://review.whamcloud.com/14568
Subject: LU-6491 llog: fix wrong return value for too long fsname
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 88b4af7b6e98462ccf8a62252d2442bd9ef8c416

Comment by Peter Jones [ 24/Apr/15 ]

Emoly

Could you please take care of this patch?

Thanks

Peter

Comment by Gerrit Updater [ 28/May/15 ]

Oleg Drokin (oleg.drokin@intel.com) merged in patch http://review.whamcloud.com/14568/
Subject: LU-6491 llog: fix wrong return value for too long fsname
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 5b6d23d7fb8de7ae44ca369381a128c78f78bf21

Comment by Peter Jones [ 28/May/15 ]

Landed for 2.8

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