Whamcloud - gitweb
LU-3996 mgs: Don't close llog that we failed to open 42/7742/4
authorOleg Drokin <oleg.drokin@intel.com>
Tue, 24 Sep 2013 14:32:44 +0000 (10:32 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 25 Oct 2013 02:23:08 +0000 (02:23 +0000)
Attempting to do so leads to a crash:
LustreError: 8136:0:(llog_osd.c:241:llog_osd_read_header()) MGS-osd: error reading log header from [0xa:0xa:0x0]: rc = -14
LustreError: 8136:0:(mgs_llog.c:1386:record_start_log()) MGS: can't start log lustre-params: rc = -14
BUG: unable to handle kernel NULL pointer dereference at 00000000000000b8
IP: [<ffffffffa07f9e99>] llog_handle_put+0x9/0x70 [obdclass]
PGD 8120c8067 PUD 7b8c65067 PMD 0
Oops: 0000 [#1] SMP
...
Call Trace:
 [<ffffffffa07f9f5d>] llog_close+0x5d/0x190 [obdclass]
 [<ffffffffa0e98e8d>] mgs_write_log_direct_all+0x28d/0x7a0 [mgs]
 [<ffffffffa06c8951>] ? libcfs_debug_msg+0x41/0x50 [libcfs]
 [<ffffffffa0e99d3d>] mgs_write_log_param+0x99d/0x2980 [mgs]
 [<ffffffff81167610>] ? cache_alloc_refill+0x1c0/0x240
 [<ffffffffa0ea00b0>] mgs_setparam+0xde0/0x11a0 [mgs]
 [<ffffffffa0e8c7e2>] mgs_iocontrol+0x10c2/0x16e0 [mgs]
 [<ffffffffa07f70a7>] ? obd_ioctl_getdata+0x477/0x1120 [obdclass]
 [<ffffffffa080e344>] class_handle_ioctl+0x12e4/0x1e70 [obdclass]
 [<ffffffffa06c8951>] ? libcfs_debug_msg+0x41/0x50 [libcfs]
 [<ffffffffa07f62ab>] obd_class_ioctl+0x4b/0x190 [obdclass]
 [<ffffffff81195352>] vfs_ioctl+0x22/0xa0
 [<ffffffff811954f4>] do_vfs_ioctl+0x84/0x580
 [<ffffffff81195a71>] sys_ioctl+0x81/0xa0
 [<ffffffff8100b072>] system_call_fastpath+0x16/0x1b

Change-Id: I2bd72c130a0530cc9d218556b5b6cc9c14efc2ea
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Reviewed-on: http://review.whamcloud.com/7742
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Mike Pershin <mike.pershin@intel.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
lustre/mgs/mgs_llog.c

index fb9ae68..4cb0eb0 100644 (file)
@@ -1465,7 +1465,8 @@ int mgs_write_log_direct_all(const struct lu_env *env,
        if (mgs_log_is_empty(env, mgs, logname)) {
                struct llog_handle *llh = NULL;
                rc = record_start_log(env, mgs, &llh, logname);
        if (mgs_log_is_empty(env, mgs, logname)) {
                struct llog_handle *llh = NULL;
                rc = record_start_log(env, mgs, &llh, logname);
-               record_end_log(env, &llh);
+               if (rc == 0)
+                       record_end_log(env, &llh);
         }
         name_destroy(&logname);
         if (rc)
         }
         name_destroy(&logname);
         if (rc)