Received: by 2002:a17:90a:88:0:0:0:0 with SMTP id a8csp174272pja; Fri, 22 Nov 2019 05:03:32 -0800 (PST) X-Google-Smtp-Source: APXvYqwMmIV67wg1ZPoSGbJmqCYZmAhf8fX+Zpb0qYHJpi65TRNeaRkaf6TTVqHZql5qPWeZhoxG X-Received: by 2002:a2e:7202:: with SMTP id n2mr11187188ljc.194.1574427812039; Fri, 22 Nov 2019 05:03:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574427812; cv=none; d=google.com; s=arc-20160816; b=NFENruzEW/FzZlpP1A9zqM5moagvJLfxv0V2Ure8t8sWV8uewL3jTObRPDUZtlfRtl PV1VREyapE/A0hTZjQUVaQV+taUMeFkMxAeu5oE6HmcUui5XBXpXDTDlJg84TbQ0hKhQ D+JIOLGk5p/8ON5iWPIAbGIbT+HTC2oRmh8D6t+sCYS+X6WQDYfvFe+dv4xIoIGKjSfs fp0tlFEK7ZrURfvh9iH4V3MjGh8+8DjKPAx3JayexurH4PSsmd6OlUn0othu6gtFCdPU f6z55jWJeLL0TEYu3a65mkjLM7UYF9z4TgkEXBhCxpklYyD857j8mK+5o+PaAWJCgruP G06Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition :content-transfer-encoding:user-agent:in-reply-to:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=/ETyTIpWW0X6VRUyIQmpufjqzQzz/3LOVGP1+Sl83YY=; b=sYioQ+pDBznkx1HvAlRpnhis+a+C1Evq+EDd2gknTCGj5atZePL9H7+qovWxRrlgo8 Ncy8FkBabyjQ7VuVNYC0yH9Jz+F/bIEiKt38L6NICDhL3XmrG3UIr1Evd0HwJQai6VGg DEkIf3nn4LEIOWjOO0KOERolys9okzw81YKmAEBKaFC1nOY/ZmcJyRhuKGnDF0vjjwOP zWBH07hvD7fUstwZHdaeOfIaBT/rUdPRQiZlzjn6wt24Z9kzmYogAkGFWgUfjLPZOdHr U27NPkS5TmwLTvBBILcZroKkwwunjNcBGbFtnL/U9j0GhpTg7nReB80oGEDfZqqWeXFe QyuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LP5DlBDE; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r12si3628357lji.111.2019.11.22.05.02.36; Fri, 22 Nov 2019 05:03:32 -0800 (PST) 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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=LP5DlBDE; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727571AbfKVNAw (ORCPT + 99 others); Fri, 22 Nov 2019 08:00:52 -0500 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:57242 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726813AbfKVNAw (ORCPT ); Fri, 22 Nov 2019 08:00:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1574427650; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/ETyTIpWW0X6VRUyIQmpufjqzQzz/3LOVGP1+Sl83YY=; b=LP5DlBDESlBh69QRl9ZTDmtbMb4VgSZMwADch7N1l4LNKEAgOminVQN9A2ev4mZgCBFgeA kcd+eT09IlVyYMAfkRXK6rkRo2IuSCx1hpu+igEy/90Aw8cUMh0exuwpup7RYAi3NwpUsU GaV10UWY4vCHRElWxEYHe3h0OggK27Q= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-398-TZiyAIdROzSjwdbLH4TeZw-1; Fri, 22 Nov 2019 08:00:44 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 506291852E21; Fri, 22 Nov 2019 13:00:43 +0000 (UTC) Received: from horse.redhat.com (unknown [10.18.25.35]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1DA5960141; Fri, 22 Nov 2019 13:00:43 +0000 (UTC) Received: by horse.redhat.com (Postfix, from userid 10451) id 893BF220AFF; Fri, 22 Nov 2019 08:00:42 -0500 (EST) Date: Fri, 22 Nov 2019 08:00:42 -0500 From: Vivek Goyal To: Stefan Hajnoczi Cc: virtio-fs@redhat.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, dgilbert@redhat.com, miklos@szeredi.hu Subject: Re: [PATCH 4/4] virtiofs: Support blocking posix locks (fcntl(F_SETLKW)) Message-ID: <20191122130042.GB8636@redhat.com> References: <20191115205705.2046-1-vgoyal@redhat.com> <20191115205705.2046-5-vgoyal@redhat.com> <20191121170020.GE445244@stefanha-x1.localdomain> MIME-Version: 1.0 In-Reply-To: <20191121170020.GE445244@stefanha-x1.localdomain> User-Agent: Mutt/1.12.1 (2019-06-15) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: TZiyAIdROzSjwdbLH4TeZw-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 21, 2019 at 05:00:20PM +0000, Stefan Hajnoczi wrote: [..] > > +static int virtio_fs_handle_notify(struct virtio_fs *vfs, > > +=09=09=09=09 struct virtio_fs_notify *notify) > > +{ > > +=09int ret =3D 0; > > +=09struct fuse_out_header *oh =3D ¬ify->out_hdr; > > +=09struct fuse_notify_lock_out *lo; > > + > > +=09/* > > +=09 * For notifications, oh.unique is 0 and oh->error contains code > > +=09 * for which notification as arrived. > > +=09 */ > > +=09switch(oh->error) { > > +=09case FUSE_NOTIFY_LOCK: > > +=09=09lo =3D (struct fuse_notify_lock_out *) ¬ify->outarg; > > +=09=09notify_complete_waiting_req(vfs, lo); > > +=09=09break; > > +=09default: > > +=09=09printk("virtio-fs: Unexpected notification %d\n", oh->error); > > +=09} > > +=09return ret; > > +} >=20 > Is this specific to virtio or can be it handled in common code? This is not specific to virtio_fs. In principle, regular fuse daemon could implement something similar. Though they might not have to because client can just block without introducing deadlock possibilities. Anyway, I will look into moving this code into fuse common. [..] > > diff --git a/include/uapi/linux/fuse.h b/include/uapi/linux/fuse.h > > index 373cada89815..45f0c4efec8e 100644 > > --- a/include/uapi/linux/fuse.h > > +++ b/include/uapi/linux/fuse.h > > @@ -481,6 +481,7 @@ enum fuse_notify_code { > > =09FUSE_NOTIFY_STORE =3D 4, > > =09FUSE_NOTIFY_RETRIEVE =3D 5, > > =09FUSE_NOTIFY_DELETE =3D 6, > > +=09FUSE_NOTIFY_LOCK =3D 7, > > =09FUSE_NOTIFY_CODE_MAX, > > }; > > =20 > > @@ -868,6 +869,12 @@ struct fuse_notify_retrieve_in { > > =09uint64_t=09dummy4; > > }; > > =20 > > +struct fuse_notify_lock_out { > > +=09uint64_t=09id; >=20 > Please call this field "unique" or "lock_unique" so it's clear this > identifier is the fuse_header_in->unique value of the lock request. Ok, will do. Vivek