Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-8671

bad error handling in mgs_object_init

Details

    • Bug
    • Resolution: Duplicate
    • Minor
    • None
    • None
    • 3
    • 9223372036854775807

    Description

      The function mgs_object_init() lost an error code return and always return zero as success.
      Need to return proper error code.

      lustre-wc-rel/lustre/mgs/mgs_handler.c:
      static int mgs_object_init(const struct lu_env *env, struct lu_object *o,
      const struct lu_object_conf *unused)
      {
      struct mgs_device *d = lu2mgs_dev(o->lo_dev);
      struct lu_device *under;
      struct lu_object *below;
      int rc = 0;
      ENTRY;

      /* do no set .do_ops as mgs calls to bottom osd directly */

      CDEBUG(D_INFO, "object init, fid = "DFID"\n",
      PFID(lu_object_fid(o)));

      under = &d->mgs_bottom->dd_lu_dev;
      below = under->ld_ops->ldo_object_alloc(env, o->lo_header, under);
      if (below != NULL)
      lu_object_add(o, below);
      else
      rc = ENOMEM;<-- Variable 'rc' is assigned a value that is never used.

      return 0;
      }

      Attachments

        Issue Links

          Activity

            [LU-8671] bad error handling in mgs_object_init

            This is fixed in patch http://review.whamcloud.com/23221 "LU-8378 all: remove set but unused variables"

            adilger Andreas Dilger added a comment - This is fixed in patch http://review.whamcloud.com/23221 " LU-8378 all: remove set but unused variables"

            lustre-wc-rel/lustre/mgs/mgs_handler.c:

            static int mgs_object_init(const struct lu_env *env, struct lu_object *o,
            			   const struct lu_object_conf *unused)
            {
            	struct mgs_device *d = lu2mgs_dev(o->lo_dev);
            	struct lu_device  *under;
            	struct lu_object  *below;
            	int                rc = 0;
            	ENTRY;
            
            	/* do no set .do_ops as mgs calls to bottom osd directly */
            
            	CDEBUG(D_INFO, "object init, fid = "DFID"\n",
            			PFID(lu_object_fid(o)));
            
            	under = &d->mgs_bottom->dd_lu_dev;
            	below = under->ld_ops->ldo_object_alloc(env, o->lo_header, under);
            	if (below != NULL)
            		lu_object_add(o, below);
            	else
            		rc = -ENOMEM;<--- Variable 'rc' is assigned a value that is never used.
            
            	return 0;
            }
            
            maximus Ashish Purkar (Inactive) added a comment - lustre-wc-rel/lustre/mgs/mgs_handler.c: static int mgs_object_init( const struct lu_env *env, struct lu_object *o, const struct lu_object_conf *unused) { struct mgs_device *d = lu2mgs_dev(o->lo_dev); struct lu_device *under; struct lu_object *below; int rc = 0; ENTRY; /* do no set .do_ops as mgs calls to bottom osd directly */ CDEBUG(D_INFO, "object init, fid = " DFID "\n" , PFID(lu_object_fid(o))); under = &d->mgs_bottom->dd_lu_dev; below = under->ld_ops->ldo_object_alloc(env, o->lo_header, under); if (below != NULL) lu_object_add(o, below); else rc = -ENOMEM;<--- Variable 'rc' is assigned a value that is never used. return 0; }

            Ashish Purkar (ashish.purkar@seagate.com) uploaded a new patch: http://review.whamcloud.com/22973
            Subject: LU-8671 mgs: correct error handling in mgs_object_init()
            Project: fs/lustre-release
            Branch: master
            Current Patch Set: 1
            Commit: 8f9b3b257467a564ba91bbabade5dab21ccd521c

            gerrit Gerrit Updater added a comment - Ashish Purkar (ashish.purkar@seagate.com) uploaded a new patch: http://review.whamcloud.com/22973 Subject: LU-8671 mgs: correct error handling in mgs_object_init() Project: fs/lustre-release Branch: master Current Patch Set: 1 Commit: 8f9b3b257467a564ba91bbabade5dab21ccd521c

            People

              wc-triage WC Triage
              maximus Ashish Purkar (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: