From 8effee25f5537bc66e8f2418ef867b461b639b03 Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Tue, 24 Sep 2013 10:32:44 -0400 Subject: [PATCH] LU-3996 mgs: Don't close llog that we failed to open 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: [] llog_handle_put+0x9/0x70 [obdclass] PGD 8120c8067 PUD 7b8c65067 PMD 0 Oops: 0000 [#1] SMP ... Call Trace: [] llog_close+0x5d/0x190 [obdclass] [] mgs_write_log_direct_all+0x28d/0x7a0 [mgs] [] ? libcfs_debug_msg+0x41/0x50 [libcfs] [] mgs_write_log_param+0x99d/0x2980 [mgs] [] ? cache_alloc_refill+0x1c0/0x240 [] mgs_setparam+0xde0/0x11a0 [mgs] [] mgs_iocontrol+0x10c2/0x16e0 [mgs] [] ? obd_ioctl_getdata+0x477/0x1120 [obdclass] [] class_handle_ioctl+0x12e4/0x1e70 [obdclass] [] ? libcfs_debug_msg+0x41/0x50 [libcfs] [] obd_class_ioctl+0x4b/0x190 [obdclass] [] vfs_ioctl+0x22/0xa0 [] do_vfs_ioctl+0x84/0x580 [] sys_ioctl+0x81/0xa0 [] system_call_fastpath+0x16/0x1b Change-Id: I2bd72c130a0530cc9d218556b5b6cc9c14efc2ea Signed-off-by: Oleg Drokin Reviewed-on: http://review.whamcloud.com/7742 Reviewed-by: Andreas Dilger Reviewed-by: Mike Pershin Tested-by: Hudson Tested-by: Maloo --- lustre/mgs/mgs_llog.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lustre/mgs/mgs_llog.c b/lustre/mgs/mgs_llog.c index fb9ae68..4cb0eb0 100644 --- a/lustre/mgs/mgs_llog.c +++ b/lustre/mgs/mgs_llog.c @@ -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); - record_end_log(env, &llh); + if (rc == 0) + record_end_log(env, &llh); } name_destroy(&logname); if (rc) -- 1.8.3.1