]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
staging: lustre: lov: new pattern flag for partially repaired file
authorFan Yong <fan.yong@intel.com>
Tue, 16 Aug 2016 20:19:03 +0000 (16:19 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 21 Aug 2016 13:57:37 +0000 (15:57 +0200)
When the layout LFSCK repairs orphan OST-object, if the parent
MDT-object was lost, then it will re-create the MDT-object and
regenerate the LOV EA and fill the target LOV EA slot with the
orphan information, and fill other slots with zero (LOV hole);
if related LOV EA slot is invalid or hole, then it will refill
the target LOV EA slot; if the target slot exceeds current LOV
EA tail, then extend the LOV EA, and fill the gaps as zero.

Some of the LOV EA holes may cannot be re-filled finally because
of lost some OST-objects. And even if they can be re-filled, but
there are still some possible race accessings from client before
the re-filling. If the client access the LOV EA with hole(s), it
may cause some strange behaviour, such as trigger LBUG()/LASSERT()
on the client.

So we will make the client to be aware of the LOV EA is incomplete.
We introduce a new LOV EA pattern flag LOV_PATTERN_F_HOLE for that:
any time when the LFSCK repairs the LOV EA with hole(s), the LOV EA
will be marked as LOV_PATTERN_F_HOLE; when all the holes in the LOV
EA are refilled, the LOV_PATTERN_F_HOLE will be dropped.

For a new client, it recongizes the pattern flag LOV_PATTERN_F_HOLE,
then it can permit/forbid some opertions on the file with LOV holes:

 1) Normal read/write the file with LOV EA hole is permitted, but the
    application will get EIO error when read data from the dummy slot
    or write data to the dummy slot.
 2) The users can dump the recovered data via some common read tools,
    such as "dd conv=sync,noerror".

 3) Append data to the file which has LOV EA hole will get EIO failure.

 4) Other operations will skip the LOV EA hole(s), and will not get
    failures, such as {s,g}etattr, {s,g}getxattr, stat, chown/chgrp,
    chmod, touch, unlink, and so on.

For an old client, since it will not recognize the new pattern flag
LOV_PATTERN_F_HOLE. So the LOV EA with hole will be dicarded with
failure, but it will not cause the client to be crashed.

Signed-off-by: Fan Yong <fan.yong@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4675
Reviewed-on: http://review.whamcloud.com/10042
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
drivers/staging/lustre/lustre/include/lustre/lustre_user.h
drivers/staging/lustre/lustre/llite/llite_lib.c
drivers/staging/lustre/lustre/lov/lov_io.c
drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
drivers/staging/lustre/lustre/ptlrpc/wiretest.c

index 69bed64e895b73fb95220c558d3c8e6c6911b326..87eef4c88d4812175651c3f4c38c78d9a45d997b 100644 (file)
@@ -1289,6 +1289,7 @@ void lustre_swab_ptlrpc_body(struct ptlrpc_body *pb);
 #define OBD_CONNECT_OPEN_BY_FID        0x20000000000000ULL     /* open by fid won't pack
                                                         * name in request
                                                         */
+#define OBD_CONNECT_LFSCK      0x40000000000000ULL/* support online LFSCK */
 
 /* XXX README XXX:
  * Please DO NOT add flag values here before first ensuring that this same
index 8398c4fc4cab71f2145c9d4a426b0a55a538278e..9e38ed38681f52e1a6323ae9b73f4d7c90bcfd5c 100644 (file)
@@ -284,9 +284,9 @@ struct ost_id {
 #define LOV_PATTERN_CMOBD      0x200
 
 #define LOV_PATTERN_F_MASK     0xffff0000
+#define LOV_PATTERN_F_HOLE     0x40000000 /* there is hole in LOV EA */
 #define LOV_PATTERN_F_RELEASED 0x80000000 /* HSM released file */
 
-
 #define LOV_MAXPOOLNAME 16
 #define LOV_POOLNAMEF "%.16s"
 
index ac59cd6c344b8d3a307ae6d658ffc7e5fcc45fdf..dd44ee8408db8f836332f6aaf2437f1fef0e69a5 100644 (file)
@@ -189,7 +189,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
                                  OBD_CONNECT_PINGLESS |
                                  OBD_CONNECT_MAX_EASIZE |
                                  OBD_CONNECT_FLOCK_DEAD |
-                                 OBD_CONNECT_DISP_STRIPE;
+                                 OBD_CONNECT_DISP_STRIPE | OBD_CONNECT_LFSCK;
 
        if (sbi->ll_flags & LL_SBI_SOM_PREVIEW)
                data->ocd_connect_flags |= OBD_CONNECT_SOM;
index 84032a51025423aa78ee2786e307b2e3c183ea49..95126c34952423b6036f58dfe44716e492adde5c 100644 (file)
@@ -298,8 +298,8 @@ static int lov_io_subio_init(const struct lu_env *env, struct lov_io *lio,
        return result;
 }
 
-static void lov_io_slice_init(struct lov_io *lio,
-                             struct lov_object *obj, struct cl_io *io)
+static int lov_io_slice_init(struct lov_io *lio, struct lov_object *obj,
+                            struct cl_io *io)
 {
        io->ci_result = 0;
        lio->lis_object = obj;
@@ -314,6 +314,15 @@ static void lov_io_slice_init(struct lov_io *lio,
                lio->lis_io_endpos = lio->lis_endpos;
                if (cl_io_is_append(io)) {
                        LASSERT(io->ci_type == CIT_WRITE);
+
+                       /*
+                        * If there is LOV EA hole, then we may cannot locate
+                        * the current file-tail exactly.
+                        */
+                       if (unlikely(obj->lo_lsm->lsm_pattern &
+                                    LOV_PATTERN_F_HOLE))
+                               return -EIO;
+
                        lio->lis_pos = 0;
                        lio->lis_endpos = OBD_OBJECT_EOF;
                }
@@ -349,6 +358,7 @@ static void lov_io_slice_init(struct lov_io *lio,
        default:
                LBUG();
        }
+       return 0;
 }
 
 static void lov_io_fini(const struct lu_env *env, const struct cl_io_slice *ios)
@@ -870,7 +880,7 @@ int lov_io_init_raid0(const struct lu_env *env, struct cl_object *obj,
        struct lov_object   *lov = cl2lov(obj);
 
        INIT_LIST_HEAD(&lio->lis_active);
-       lov_io_slice_init(lio, lov, io);
+       io->ci_result = lov_io_slice_init(lio, lov, io);
        if (io->ci_result == 0) {
                io->ci_result = lov_io_subio_init(env, lio, io);
                if (io->ci_result == 0) {
index c83d28e7e763c154c5713df7fb186422898dec89..f42ed17996d736add2ddfbe3cb67efeb2679b0d4 100644 (file)
@@ -97,6 +97,8 @@ static const char * const obd_connect_names[] = {
        "flock_deadlock",
        "disp_stripe",
        "unknown",
+       "lfsck",
+       "unknown",
        NULL
 };
 
index bc27f8d61e290da8c6705869e80a934e66397ec6..9d5d2c8c6acb9c977eb3dabc11827efd3d04537d 100644 (file)
@@ -1071,6 +1071,8 @@ void lustre_assert_wire_constants(void)
                 "found 0x%.16llxULL\n", OBD_CONNECT_FLOCK_DEAD);
        LASSERTF(OBD_CONNECT_OPEN_BY_FID == 0x20000000000000ULL,
                 "found 0x%.16llxULL\n", OBD_CONNECT_OPEN_BY_FID);
+       LASSERTF(OBD_CONNECT_LFSCK == 0x40000000000000ULL, "found 0x%.16llxULL\n",
+                OBD_CONNECT_LFSCK);
        LASSERTF(OBD_CKSUM_CRC32 == 0x00000001UL, "found 0x%.8xUL\n",
                (unsigned)OBD_CKSUM_CRC32);
        LASSERTF(OBD_CKSUM_ADLER == 0x00000002UL, "found 0x%.8xUL\n",