From patchwork Mon Oct 16 09:12:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Dryomov X-Patchwork-Id: 10007939 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CF073601D5 for ; Mon, 16 Oct 2017 09:13:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C44E4283D9 for ; Mon, 16 Oct 2017 09:13:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B8EDA283F5; Mon, 16 Oct 2017 09:13:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 119DF283D9 for ; Mon, 16 Oct 2017 09:13:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751994AbdJPJM4 (ORCPT ); Mon, 16 Oct 2017 05:12:56 -0400 Received: from mail-it0-f66.google.com ([209.85.214.66]:57154 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751410AbdJPJMz (ORCPT ); Mon, 16 Oct 2017 05:12:55 -0400 Received: by mail-it0-f66.google.com with SMTP id r127so324653itb.5; Mon, 16 Oct 2017 02:12:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=YfIq+waZnyhamIC7NaxPCrdEJx9w+I1BjAQotabOZGI=; b=pJMlEmDdtaQ3azKuoYCxNk1nbGfe7/62WNETh2TZ/w0raVvLufCfBavsQAMEiZ1sl2 0sA4rLW71hkvHm9kjhoRRExViCGy3F9O/FoP+zYCSYKlL8vrV0IM1hW9B1j0Hp8kt4kV 0hbIoOLw9Z9IBIofviyqi+OMu1fpOntpYuaPfr3IKuhIu7PJ8rUpjKWARprZ+0+qmTY1 bxPU+LvVV1fLNuLAWkIFt7XRT2fs5PuhO+FjKhbDoizfuGznvYT9Gjxbt2WWejwuYMhG /Tk46A4V7PKEB1dTUY2++1Q7+u/n3FBsblAEcGynCeA6KuuRrOhgqWBue4Tty+6fhPCw mwog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=YfIq+waZnyhamIC7NaxPCrdEJx9w+I1BjAQotabOZGI=; b=moO036EmsZvP6RF/x4APFCb78nSjZLDGu7fD/qTSIjoOnMBX2ClBoKVYBjIhgzorls L0S8r3iUNJWXoSNVZDNysmf710nywcvVP5140xEOn2+PZvr6nYw/0AnvJ6cNG24nGC8d GdPd1J445HdOwrleY3vsJNjljEGcO//w6Qh8DmHJuib7HrQx06psqh3NrmNMYMGswrHQ tJnqi6fBIds5CNqbMZq2bK15cAWAaluuVKOdv9WAdXWQyMu5WwkJvWaHEK2YFgAr+8RY /+p2f+6pJmauvUK/4g3Xd6XKl1X8mjPPgQxqQjDWZOYAXxP8ZYEglNDEDHQX95irc/s9 3pkg== X-Gm-Message-State: AMCzsaXz/XfU68kGM9Z9+1lja4uZIt+I8c4f7CAGngusIHvOH0xtHPpv TL9BfptbVEmvotlbCiWdmx2nPek75NdIIptgdnE= X-Google-Smtp-Source: ABhQp+TL3GsrKqa6bAVAfvzwJ+8VcwKcHt1TMtPUtkdnql62UUCP7HOiKPlp0WoOdRJp/ncLTkTzZFExagiqDRJ+s7g= X-Received: by 10.36.202.3 with SMTP id k3mr274927itg.87.1508145174341; Mon, 16 Oct 2017 02:12:54 -0700 (PDT) MIME-Version: 1.0 Received: by 10.2.96.42 with HTTP; Mon, 16 Oct 2017 02:12:53 -0700 (PDT) In-Reply-To: <1507975272-8264-1-git-send-email-chris.gekas@gmail.com> References: <1507975272-8264-1-git-send-email-chris.gekas@gmail.com> From: Ilya Dryomov Date: Mon, 16 Oct 2017 11:12:53 +0200 Message-ID: Subject: Re: [PATCH] ceph: Delete unused variable in mds_client To: Christos Gkekas Cc: Gregory Farnum , Yan Zheng , Sage Weil , ceph-devel , "linux-kernel@vger.kernel.org" Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Sat, Oct 14, 2017 at 12:01 PM, Christos Gkekas wrote: > Variable 'err' is set but never used, so should be removed. > > Signed-off-by: Christos Gkekas > --- > fs/ceph/mds_client.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c > index f23c820..7cd4fd9 100644 > --- a/fs/ceph/mds_client.c > +++ b/fs/ceph/mds_client.c > @@ -3801,7 +3801,6 @@ void ceph_mdsc_handle_fsmap(struct ceph_mds_client *mdsc, struct ceph_msg *msg) > u32 num_fs; > u32 mount_fscid = (u32)-1; > u8 struct_v, struct_cv; > - int err = -EINVAL; > > ceph_decode_need(&p, end, sizeof(u32), bad); > epoch = ceph_decode_32(&p); > @@ -3852,7 +3851,6 @@ void ceph_mdsc_handle_fsmap(struct ceph_mds_client *mdsc, struct ceph_msg *msg) > 0, true); > ceph_monc_renew_subs(&fsc->client->monc); > } else { > - err = -ENOENT; > goto err_out; > } > return; This doesn't seem right. I think the original intent was to return -EINVAL if decoding fails (like we do in many other places) and -ENOENT if there is no filesystem with that name. This is user-visible: it's propagated all the way up and reported by mount(8). I'd rather we do something like this: commit 2b330133e10e7f53f0b169335c3b6000782e9123 Author: Ilya Dryomov Date: Mon Oct 16 10:32:50 2017 +0200 ceph: -EINVAL on decoding failure in ceph_mdsc_handle_fsmap() Don't set ->mdsmap_err to -ENOENT unconditionally, and drop unneeded return statement while at it. Signed-off-by: Ilya Dryomov /* Thanks, Ilya --- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 51f8af685a1f..aaa8879c8098 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -3878,14 +3878,14 @@ void ceph_mdsc_handle_fsmap(struct ceph_mds_client *mdsc, struct ceph_msg *msg) goto err_out; } return; + bad: pr_err("error decoding fsmap\n"); err_out: mutex_lock(&mdsc->mutex); - mdsc->mdsmap_err = -ENOENT; + mdsc->mdsmap_err = err; __wake_requests(mdsc, &mdsc->waiting_for_map); mutex_unlock(&mdsc->mutex); - return; }