Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp162552ybb; Thu, 2 Apr 2020 23:45:21 -0700 (PDT) X-Google-Smtp-Source: APiQypIvEm4yLBZa/gkD9q2NxWwcIqHmrtBSOSTNhcsIAKq2F7lksQkK13/LeWfAV8m1odEANqXO X-Received: by 2002:aca:5191:: with SMTP id f139mr2013077oib.140.1585896321490; Thu, 02 Apr 2020 23:45:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585896321; cv=none; d=google.com; s=arc-20160816; b=M0La7jlXztFBYbFH2vKOGuaKvy5F5jk6EFhLlqLxU032ZrqnHb/FFf3bXSgzSyb0Da WpldGTZEDYynKDHJKjC7jgOv0BgjfgsZS3cPb931y1GvJv2rGOCBEq9UMcmZGmq+jTLJ xxJhlIC4Hixp4zsLMW4XrLZuNDTX6Z8hKY4ff9jYR8v0OMuJSV9/9eKu3qC11G5rKHqm oCqg3E5Etoj1M9h46Ngyu+9FUoEsdd9ndKMmeT1lOUkK3vfyGyFJvSZ7krx8834z4Z6d +FqyxfEc3QuedqjlsdiDN5GeRLFg/rXOS5DdW3PzoAjIsruOGKbvwqRfC+XxNFCnkP0i Tyvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=cpN8baYHBK0m+esyAkfv57q4eY6DQ3NMtam3t0904og=; b=kRXZapfVG3bUB+h2DILHju2lByS6YUQAycol9HDOdPLf0cZnXg9GafJfj8M/mqktC2 fqO2AIiNOKXSujULFLT9dVVeB3tmEXx+m/jqzth2xpX8wqhP8RZjhB/iO3N9jLwXc0aF eUbCXt513b8gFiYff1CU+cBu0k/0D9XRaigV+E/BWa5SypMpeGcFk+YHtIf3h/gpOp1P 8myYjVj8rMBrM6ASPIGIEz8Sob/lC0fg4OU87syQ1nsDMNSbMQSN0ohDzfDVXS7mhI8k 9/J5ke85pqKFAue3n857zeeXWvbg0lXH8jimFs6PcnjYqSt/+8Qk5eNc7lVcpnJjjvn8 lm1g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k92si3434901otk.261.2020.04.02.23.45.08; Thu, 02 Apr 2020 23:45:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388623AbgDCGne (ORCPT + 99 others); Fri, 3 Apr 2020 02:43:34 -0400 Received: from verein.lst.de ([213.95.11.211]:51275 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730759AbgDCGne (ORCPT ); Fri, 3 Apr 2020 02:43:34 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id E9AE468B05; Fri, 3 Apr 2020 08:43:31 +0200 (CEST) Date: Fri, 3 Apr 2020 08:43:31 +0200 From: Christoph Hellwig To: Anthony Iliopoulos Cc: Christoph Hellwig , Sagi Grimberg , Chaitanya Kulkarni , linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] nvmet: add revalidation support to bdev and file backed namespaces Message-ID: <20200403064331.GA23270@lst.de> References: <20200402193052.19935-1-ailiop@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200402193052.19935-1-ailiop@suse.com> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 02, 2020 at 09:30:52PM +0200, Anthony Iliopoulos wrote: > Add support for detecting capacity changes on nvmet blockdev and file > backed namespaces. This allows for emulating and testing online resizing > of nvme devices and filesystems on top. > > Signed-off-by: Anthony Iliopoulos I vaguely remember seeing a very similar patch before, is this a repost? > +void nvmet_bdev_ns_revalidate(struct nvmet_ns *ns) > +{ > + loff_t size; > + > + size = i_size_read(ns->bdev->bd_inode); > + > + if (ns->size != size) > + ns->size = size; This can be: ns->size = i_size_read(ns->bdev->bd_inode); > +void nvmet_file_ns_revalidate(struct nvmet_ns *ns) > +{ > + struct kstat stat; > + > + if (!ns->file) > + return; Shouldn't this always be non-NULL? > + > + if (vfs_getattr(&ns->file->f_path, > + &stat, STATX_SIZE, AT_STATX_FORCE_SYNC)) > + return; Use up the full line: if (vfs_getattr(&ns->file->f_path, &stat, STATX_SIZE, AT_STATX_FORCE_SYNC)) Also shouldn't there be error handling? If we can't stat the file the namespace is toast.