From patchwork Fri Sep 7 15:45:35 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 1423621 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 82F523FC85 for ; Fri, 7 Sep 2012 15:45:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752871Ab2IGPpi (ORCPT ); Fri, 7 Sep 2012 11:45:38 -0400 Received: from mail-ie0-f174.google.com ([209.85.223.174]:57175 "EHLO mail-ie0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751857Ab2IGPph (ORCPT ); Fri, 7 Sep 2012 11:45:37 -0400 Received: by mail-ie0-f174.google.com with SMTP id e11so5262969iej.19 for ; Fri, 07 Sep 2012 08:45:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=QRk5QBt1GnuUU5J7UkG+2YZpJ26Yzle5ZB+YjXcviko=; b=K2bMMdfPr1pBZtq7TddyPr7+p10TuDW3ZY+1OK5+MZ26B5AqnzwubratpSWM2rjuC3 8yWrDvCQcUg5Gz0mFDkW5dserS6MMEpaH7wId85k+DpTnPwuhBtCY4FXe9o8fJagi8WK loRGcZ0eLBo5uPys6OLpOBY4hF95N0jZJEVPA3t7dDApK5Qk6naHQv+PgNPwv2FFRRKE F99hhvggKc0lLoZaRB8hA/VZcH7ja3OM6f/ldAR44x/bryKjnlRg5C/YTJgJWvUs/XyU FNwtvDIapsVnlZCCy/phy2cgmV9cjSQRv9fkOsp1w0HLPxJfyU+ahSupEc7a3ZHWfAex nD4w== Received: by 10.50.181.200 with SMTP id dy8mr22390516igc.38.1347032737637; Fri, 07 Sep 2012 08:45:37 -0700 (PDT) Received: from [172.22.22.4] (c-71-195-31-37.hsd1.mn.comcast.net. [71.195.31.37]) by mx.google.com with ESMTPS id wg9sm8596935igb.0.2012.09.07.08.45.36 (version=SSLv3 cipher=OTHER); Fri, 07 Sep 2012 08:45:36 -0700 (PDT) Message-ID: <504A169F.3070604@inktank.com> Date: Fri, 07 Sep 2012 10:45:35 -0500 From: Alex Elder User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120827 Thunderbird/15.0 MIME-Version: 1.0 To: ceph-devel@vger.kernel.org Subject: [PATCH 9/9] rbd: set up watch before announcing disk References: <504A152E.4000905@inktank.com> In-Reply-To: <504A152E.4000905@inktank.com> X-Gm-Message-State: ALoCoQlKtJOqg/J1lHuNC+PUxeJMhhasymYpsGpMqsIo2maJK98h8nZFn7Mq52iHWU9gfYq8yxhq Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org We're ready to handle header object (refresh) events at the point we call rbd_bus_add_dev(). Set up the watch request on the rbd image header just after that, and after we've registered the devices for the snapshots for the initial snapshot context. Do this before announce the disk as available for use. Signed-off-by: Alex Elder Reviewed-by: Josh Durgin --- drivers/block/rbd.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 51e1d21..daa428e3 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -2640,23 +2640,23 @@ static ssize_t rbd_add(struct bus_type *bus, if (rc) goto err_out_unlock; + rc = rbd_init_watch_dev(rbd_dev); + if (rc) + goto err_out_unlock; + up_write(&rbd_dev->header_rwsem); /* Everything's ready. Announce the disk to the world. */ add_disk(rbd_dev->disk); + pr_info("%s: added with size 0x%llx\n", rbd_dev->disk->disk_name, (unsigned long long) rbd_dev->mapping.size); - rc = rbd_init_watch_dev(rbd_dev); - if (rc) - goto err_out_bus; - return count; err_out_unlock: up_write(&rbd_dev->header_rwsem); -err_out_bus: /* this will also clean up rest of rbd_dev stuff */ rbd_bus_del_dev(rbd_dev);