From 6e2ccfca6f49e0962e59c506806b6c27be2b86be Mon Sep 17 00:00:00 2001 From: shadow Date: Thu, 17 Sep 2009 08:24:27 +0000 Subject: [PATCH] Don't allow make backward step on assignin osc next id. Branch HEAD b=19557 i=tappro i=jay --- lustre/ChangeLog | 6 ++++++ lustre/osc/osc_request.c | 15 ++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/lustre/ChangeLog b/lustre/ChangeLog index 9332e4e..24bda42 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -14,6 +14,12 @@ tbd Sun Microsystems, Inc. * File join has been disabled in this release, refer to Bugzilla 16929. Severity : normal +Bugzilla : 19557 +Description: Don't allow make backward step on assignin osc next id. +Details : race between allocation next id and ll_sync thread can be cause + of set wrong osc next id and can be kill valid ost objects. + +Severity : normal Bugzilla : 20533 Description: Changes in raid5-large-io-rhel5.patch to calculate sectors properly diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 3875089..90716fe 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -3887,11 +3887,24 @@ static int osc_set_info_async(struct obd_export *exp, obd_count keylen, OBD_FAIL_TIMEOUT(OBD_FAIL_OSC_SHUTDOWN, 10); if (KEY_IS(KEY_NEXT_ID)) { + obd_id new_val; + struct osc_creator *oscc = &obd->u.cli.cl_oscc; + if (vallen != sizeof(obd_id)) RETURN(-ERANGE); if (val == NULL) RETURN(-EINVAL); - obd->u.cli.cl_oscc.oscc_next_id = *((obd_id*)val) + 1; + + if (vallen != sizeof(obd_id)) + RETURN(-EINVAL); + + /* avoid race between allocate new object and set next id + * from ll_sync thread */ + spin_lock(&oscc->oscc_lock); + new_val = *((obd_id*)val) + 1; + if (new_val > oscc->oscc_next_id) + oscc->oscc_next_id = new_val; + spin_unlock(&oscc->oscc_lock); CDEBUG(D_HA, "%s: set oscc_next_id = "LPU64"\n", exp->exp_obd->obd_name, obd->u.cli.cl_oscc.oscc_next_id); -- 1.8.3.1