From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51389) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W872r-0001nf-VJ for qemu-devel@nongnu.org; Tue, 28 Jan 2014 06:41:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W872m-0006vd-VV for qemu-devel@nongnu.org; Tue, 28 Jan 2014 06:41:33 -0500 Received: from mga09.intel.com ([134.134.136.24]:45035) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W872m-0006rQ-Ou for qemu-devel@nongnu.org; Tue, 28 Jan 2014 06:41:28 -0500 From: "Kirill A. Shutemov" In-Reply-To: <20140128112650.GA18171@redhat.com> References: <1390906551-4845-1-git-send-email-kirill.shutemov@linux.intel.com> <20140128112650.GA18171@redhat.com> Content-Transfer-Encoding: 7bit Message-Id: <20140128114059.80CDFE0090@blue.fi.intel.com> Date: Tue, 28 Jan 2014 13:40:59 +0200 (EET) Subject: Re: [Qemu-devel] [PATCH] [RESEND-try-3] hw/9pfs: fix P9_STATS_GEN handling List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: aneesh.kumar@linux.vnet.ibm.com, armbru@redhat.com, qemu-devel@nongnu.org, "Kirill A. Shutemov" , aliguori@amazon.com Michael S. Tsirkin wrote: > On Tue, Jan 28, 2014 at 12:55:51PM +0200, Kirill A. Shutemov wrote: > > Currently we have few issues with P9_STATS_GEN: > > > > - We don't try to read st_gen anything except files or directories, but > > still set P9_STATS_GEN bit in st_result_mask. It may mislead client: > > we present garbage as valid st_gen. > > > > - If we failed to get valid st_gen with ENOTTY, we ignore error, but > > still set P9_STATS_GEN bit in st_result_mask. > > > > - If we failed to get valid st_gen with any other errno, we fail > > getattr altogether. It's excessive: we block valid client use-cases, > > like chdir(2) to non-readable directory with execution bit set. > > > > The patch fixes these issues and cleanup code a bit. > > > > Signed-off-by: Kirill A. Shutemov > > Reviewed-by: Daniel P. Berrange > > Reviewed-by: Aneesh Kumar K.V > > Would be better to split unrelated issues out to separate patches. They are not totally unrelated: they all unbreak P9_STATS_GEN. But yes, I can split if it needed. > > diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c > > index 8cbb8ae32a03..3e51fcd152f8 100644 > > --- a/hw/9pfs/virtio-9p.c > > +++ b/hw/9pfs/virtio-9p.c > > @@ -1080,10 +1080,18 @@ static void v9fs_getattr(void *opaque) > > /* fill st_gen if requested and supported by underlying fs */ > > if (request_mask & P9_STATS_GEN) { > > retval = v9fs_co_st_gen(pdu, &fidp->path, stbuf.st_mode, &v9stat_dotl); > > - if (retval < 0) { > > + switch (retval) { > > + case 0: > > + /* we have valid st_gen: update result mask */ > > + v9stat_dotl.st_result_mask |= P9_STATS_GEN; > > + break; > > + case -EINTR: > > + /* request cancelled */ > > goto out; > > Shouldn't EINTR be retried? No. It could be canceled by client (with Tflush) on purpose and client can retry if needed. -- Kirill A. Shutemov