Whamcloud - gitweb
LU-10615 osd: stop OI scrub before FLDB closed 41/31241/3
authorFan Yong <fan.yong@intel.com>
Fri, 23 Feb 2018 11:44:05 +0000 (19:44 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 3 Mar 2018 04:27:51 +0000 (04:27 +0000)
OI scrub may check FLDB when scans the device. During umount
the device, we need to stop OI scrub before closing the FLDB
to void invalid RAM accessing.

Some code optimization and cleanup.

Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: Ib358abd77f970c12b0c29a603f9bcaf8e310cc98
Reviewed-on: https://review.whamcloud.com/31241
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/osd-ldiskfs/osd_handler.c
lustre/osd-ldiskfs/osd_internal.h
lustre/osd-ldiskfs/osd_oi.c
lustre/osd-ldiskfs/osd_scrub.c
lustre/osd-zfs/osd_handler.c
lustre/osd-zfs/osd_internal.h
lustre/osd-zfs/osd_oi.c
lustre/osd-zfs/osd_scrub.c

index 18b9a58..09a6be4 100644 (file)
@@ -7479,6 +7479,7 @@ static int osd_process_config(const struct lu_env *env,
                }
                break;
        case LCFG_PRE_CLEANUP:
+               osd_scrub_stop(o);
                osd_index_backup(env, o,
                                 o->od_index_backup_policy != LIBP_NONE);
                rc = 0;
index 2e94edb..4514a36 100644 (file)
@@ -718,6 +718,7 @@ int osd_obj_spec_update(struct osd_thread_info *info, struct osd_device *osd,
 char *osd_lf_fid2name(const struct lu_fid *fid);
 int osd_scrub_start(const struct lu_env *env, struct osd_device *dev,
                    __u32 flags);
+void osd_scrub_stop(struct osd_device *dev);
 int osd_scrub_setup(const struct lu_env *env, struct osd_device *dev);
 void osd_scrub_cleanup(const struct lu_env *env, struct osd_device *dev);
 int osd_oii_insert(struct osd_device *dev, struct osd_idmap_cache *oic,
index 5dceea7..2d76101 100644 (file)
@@ -635,7 +635,7 @@ int osd_oi_lookup(struct osd_thread_info *info, struct osd_device *osd,
        if (unlikely(fid_is_last_id(fid)))
                return osd_obj_spec_lookup(info, osd, fid, id);
 
-       if (fid_is_on_ost(info, osd, fid, flags) || fid_is_llog(fid))
+       if (fid_is_llog(fid) || fid_is_on_ost(info, osd, fid, flags))
                return osd_obj_map_lookup(info, osd, fid, id);
 
 
@@ -706,7 +706,7 @@ int osd_oi_insert(struct osd_thread_info *info, struct osd_device *osd,
        if (unlikely(fid_is_last_id(fid)))
                return osd_obj_spec_insert(info, osd, fid, id, th);
 
-       if (fid_is_on_ost(info, osd, fid, flags) || fid_is_llog(fid))
+       if (fid_is_llog(fid) || fid_is_on_ost(info, osd, fid, flags))
                return osd_obj_map_insert(info, osd, fid, id, th);
 
        fid_cpu_to_be(oi_fid, fid);
@@ -818,7 +818,7 @@ int osd_oi_delete(struct osd_thread_info *info,
        if (fid_is_last_id(fid))
                return 0;
 
-       if (fid_is_on_ost(info, osd, fid, flags) || fid_is_llog(fid))
+       if (fid_is_llog(fid) || fid_is_on_ost(info, osd, fid, flags))
                return osd_obj_map_delete(info, osd, fid, th);
 
        fid_cpu_to_be(oi_fid, fid);
@@ -837,7 +837,7 @@ int osd_oi_update(struct osd_thread_info *info, struct osd_device *osd,
        if (unlikely(fid_is_last_id(fid)))
                return osd_obj_spec_update(info, osd, fid, id, th);
 
-       if (fid_is_on_ost(info, osd, fid, flags) || fid_is_llog(fid))
+       if (fid_is_llog(fid) || fid_is_on_ost(info, osd, fid, flags))
                return osd_obj_map_update(info, osd, fid, id, th);
 
        fid_cpu_to_be(oi_fid, fid);
index 2619087..acc8618 100644 (file)
@@ -2549,7 +2549,7 @@ int osd_scrub_start(const struct lu_env *env, struct osd_device *dev,
        RETURN(rc);
 }
 
-static void osd_scrub_stop(struct osd_device *dev)
+void osd_scrub_stop(struct osd_device *dev)
 {
        struct lustre_scrub *scrub = &dev->od_scrub.os_scrub;
 
index e2e9d31..1dd49c0 100644 (file)
@@ -1373,6 +1373,7 @@ static int osd_process_config(const struct lu_env *env,
                break;
        }
        case LCFG_PRE_CLEANUP:
+               osd_scrub_stop(o);
                osd_index_backup(env, o,
                                 o->od_index_backup_policy != LIBP_NONE);
                rc = 0;
index 5d423cc..298207f 100644 (file)
@@ -669,6 +669,7 @@ int osd_scrub_setup(const struct lu_env *env, struct osd_device *dev);
 void osd_scrub_cleanup(const struct lu_env *env, struct osd_device *dev);
 int osd_scrub_start(const struct lu_env *env, struct osd_device *dev,
                    __u32 flags);
+void osd_scrub_stop(struct osd_device *dev);
 int osd_oii_insert(const struct lu_env *env, struct osd_device *dev,
                   const struct lu_fid *fid, uint64_t oid, bool insert);
 int osd_oii_lookup(struct osd_device *dev, const struct lu_fid *fid,
index b499263..f042dda 100644 (file)
@@ -538,7 +538,7 @@ osd_get_name_n_idx_compat(const struct lu_env *env, struct osd_device *osd,
        if (zdn != NULL)
                *zdn = NULL;
 
-       if (fid_is_on_ost(env, osd, fid) == 1 || fid_seq(fid) == FID_SEQ_ECHO) {
+       if (fid_is_echo(fid) || fid_is_on_ost(env, osd, fid)) {
                zapid = osd_get_idx_for_ost_obj_compat(env, osd, fid,
                                                       buf, bufsize);
        } else if (unlikely(fid_seq(fid) == FID_SEQ_LOCAL_FILE)) {
@@ -572,8 +572,8 @@ uint64_t osd_get_name_n_idx(const struct lu_env *env, struct osd_device *osd,
        if (zdn != NULL)
                *zdn = NULL;
 
-       if (fid_is_on_ost(env, osd, fid) == 1 || fid_seq(fid) == FID_SEQ_ECHO ||
-           fid_is_last_id(fid)) {
+       if (fid_is_echo(fid) || fid_is_last_id(fid) ||
+           fid_is_on_ost(env, osd, fid)) {
                zapid = osd_get_idx_for_ost_obj(env, osd, fid, buf, bufsize);
        } else if (unlikely(fid_seq(fid) == FID_SEQ_LOCAL_FILE)) {
                /* special objects with fixed known fids get their name */
index 58914ae..9a5c234 100644 (file)
@@ -1387,7 +1387,7 @@ int osd_scrub_start(const struct lu_env *env, struct osd_device *dev,
        RETURN(rc == -EALREADY ? 0 : rc);
 }
 
-static void osd_scrub_stop(struct osd_device *dev)
+void osd_scrub_stop(struct osd_device *dev)
 {
        struct lustre_scrub *scrub = &dev->od_scrub;
        ENTRY;