From 65a17be2d9e1acdec5d9aebaed007d4cb6d0ca11 Mon Sep 17 00:00:00 2001 From: Oleg Drokin Date: Thu, 25 Sep 2014 22:47:19 -0400 Subject: [PATCH] LU-5648 ofd: Reject precreate requests below last_id Such requests are a sure sign that MDS idea about precreated objects for us is invalid. If we don't reject it here, objects would be potentially doubly used by multiple files. Change-Id: I633081d3768104009e1d5e9392cdfbb79f2fd221 Signed-off-by: Oleg Drokin Reviewed-on: http://review.whamcloud.com/12068 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: wangdi --- lustre/ofd/ofd_dev.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lustre/ofd/ofd_dev.c b/lustre/ofd/ofd_dev.c index 6a7dee0..7d7387a 100644 --- a/lustre/ofd/ofd_dev.c +++ b/lustre/ofd/ofd_dev.c @@ -1680,6 +1680,16 @@ static int ofd_create_hdl(struct tgt_session_info *tsi) ofd_name(ofd), POSTID(&oa->o_oi)); GOTO(out, rc = -EINVAL); } + + if (diff < 0) { + /* LU-5648 */ + CERROR("%s: invalid precreate request for " + DOSTID", last_id " LPU64 ". " + "Likely MDS last_id corruption\n", + ofd_name(ofd), POSTID(&oa->o_oi), + ofd_seq_last_oid(oseq)); + GOTO(out, rc = -EINVAL); + } } } if (diff > 0) { -- 1.8.3.1