From patchwork Tue Jul 9 11:19:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanna Czenczek X-Patchwork-Id: 13727694 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EEBB1158A29 for ; Tue, 9 Jul 2024 11:19:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720523975; cv=none; b=etQJDc4KX3HYvIRp7Ij4X2zm3FqDmr0kuliS/Web6U8fCdmZffgFB2RCZl3TqDhm9TwFhfhew9onmKDvTa8zLzzPXPoxNl4rnNjd3JZFMstCa6QE6/SVHNGgUJoQbUwA1shGzvwL00UKrEiQSFkzofvlh9vCU7rHHiAMji+Cn6s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720523975; c=relaxed/simple; bh=c6/xDqIBUH9kZJ3dSSFqPpC8zcL9m+9ITWVHyL9+N9c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=arkx17Ov6eOUt2e7hkeiTCb2Z4yO7QrH43+UZTEsjIl5Up7E0s91dXHxgpG7N3Ym1vPa7Q68ykurpcbO01GfcoKMV9D3uI+rGvg143oA1WIpQMLQC6KFx0rwcWa4Zc+Z0/ZTKErfYjdFh2HXNrMyaxyTAtHzny08Z4cDNR4sk/I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=BUljBhmw; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="BUljBhmw" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1720523973; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=i9cY1BbeC8V5UfvyXbcs6HntSp+BaCe1he0FDoMTU60=; b=BUljBhmwm8qa7IQuWBqfD3mvCUJL+IkfUINJ0i6bd2HLHFPhggKvtffHLys6C6yMBtxp1e BYvY38KIDYLySpf0GIZOhZCLo33NBbcxYJS790qc/u4CJ6jSHoxx+U+SyUTNNKvBL94SJD bRlx1Fijf7KHxAE92tmguU021HVNvoI= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-605-MoVMMh2DNcSpaBsxk3An-g-1; Tue, 09 Jul 2024 07:19:31 -0400 X-MC-Unique: MoVMMh2DNcSpaBsxk3An-g-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-42668699453so20046315e9.3 for ; Tue, 09 Jul 2024 04:19:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720523970; x=1721128770; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=i9cY1BbeC8V5UfvyXbcs6HntSp+BaCe1he0FDoMTU60=; b=r124bHz4wGjJxVdu77feMFsWPqI8K5IulT/Ge5pcsBk93sNizpCYUXxaUynJDA2tDV vNddpfI0dQzcFULOLpIDwywTwuokZ9Ri3aIRMmv0fuENbgk9g+H4GMUtqkGJ+ubyxhVJ jEWXsPGS7WrF9E2MDPPBM9r5aPsmf27MctApXWTqOlu6kY0KetJCx4n9WXGK+onmwflH O2sydA9RVVVD1b47coMRDkvhVbdluXzzRC593mgMzRjz91gibqzmkiTiKgqHAVzEjdl7 bKIwc/RlBDUWOJunoie4iWEaMeRtmdnr4BKWAnaBIhJvlcZYOV5o4hyG6deZ0ViiPBlm uZQA== X-Forwarded-Encrypted: i=1; AJvYcCUZLEqqYw1bIamHB7t9yPlLntATwfyACcT+KAKmL6ho6i2hxnhpsRUof2Md37fG+ER+VlZiY9fp9ei2KXvMIT07crARHXIAsNiVE/DliA== X-Gm-Message-State: AOJu0YywaBUZHbv4Ml6Fb0vgSi2sVyjz6ioOHYiVR7i4cnxJz3PH5rVC emBcT6MpLn/Q+0Iv+MUzmPwNITsiq4sk9dOV1wOBLXbDCDQmElej/kco6KMgVEGcghy0QqZXOYz bNKNMiNsyU78pCAtC9gxp4EXmvVLQb0miCknFdxn5bsfCKjZDm2EyV0Nnl8JqzU8= X-Received: by 2002:a05:600c:4aa9:b0:426:5b44:2be7 with SMTP id 5b1f17b1804b1-426707cea49mr20582985e9.10.1720523970698; Tue, 09 Jul 2024 04:19:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGrv6eA6i9gD88/LrJNrSNZthLrsY3bNl7E4tsBwJPh0TpR+xUYGQAK1zetmlYXCP/zrmOVNQ== X-Received: by 2002:a05:600c:4aa9:b0:426:5b44:2be7 with SMTP id 5b1f17b1804b1-426707cea49mr20582835e9.10.1720523970311; Tue, 09 Jul 2024 04:19:30 -0700 (PDT) Received: from localhost (p200300cfd74b1c2b6d9a10b1cecd2745.dip0.t-ipconnect.de. [2003:cf:d74b:1c2b:6d9a:10b1:cecd:2745]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-367cdfab106sm2254684f8f.103.2024.07.09.04.19.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jul 2024 04:19:27 -0700 (PDT) From: Hanna Czenczek To: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-doc@vger.kernel.org, virtualization@lists.linux.dev Cc: Hanna Czenczek , Miklos Szeredi , German Maglione , Stefan Hajnoczi , =?utf-8?q?Eugenio_P=C3=A9rez?= , Jonathan Corbet , Vivek Goyal Subject: [PATCH 1/2] virtio-fs: Add 'file' mount option Date: Tue, 9 Jul 2024 13:19:17 +0200 Message-ID: <20240709111918.31233-2-hreitz@redhat.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240709111918.31233-1-hreitz@redhat.com> References: <20240709111918.31233-1-hreitz@redhat.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This new option allows mounting filesystems whose root node is a regular file instead of a directory. FUSE itself has the more generic 'rootmode' option, which theoretically allows mounting filesystems with an even greater variety of root node modes. There are two reasons why we do not let virtio-fs provide that same option: First, with FUSE, this option is supposed to be set automatically by e.g. the fusermount helper program to match the root node's mode, no user involvement necessary. It is easy for fusermount to stat() the mount point (whose mode must match the filesystem's root node mode) and fill the 'rootmode' option appropriately. In the case of virtio-fs, however, mounting is often done manually by the user, there is no helper program; and I as a user find the simple '-o file' preferable over the more cryptic '-o rootmode=0100000'. Second, inode modes other than S_IFDIR and S_IFREG have limited use with virtio-fs anyway: - Device files are host-specific, so passing them via virtio-fs from host to guest (or between different guests) seems rarely useful, - FIFOs and Unix domain sockets currently do not allow communication between guest and host (or between different guests), which is really the only reason why they would be used as virtio-fs filesystem root nodes, - and symlinks in general do not make much sense as filesystem root nodes. The more generic 'rootmode' option is therefore not very useful for virtio-fs, while being harder to use. Signed-off-by: Hanna Czenczek --- fs/fuse/virtio_fs.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/fs/fuse/virtio_fs.c b/fs/fuse/virtio_fs.c index 1a52a51b6b07..ba1a6ac31000 100644 --- a/fs/fuse/virtio_fs.c +++ b/fs/fuse/virtio_fs.c @@ -107,11 +107,13 @@ static const struct constant_table dax_param_enums[] = { enum { OPT_DAX, OPT_DAX_ENUM, + OPT_FILE, }; static const struct fs_parameter_spec virtio_fs_parameters[] = { fsparam_flag("dax", OPT_DAX), fsparam_enum("dax", OPT_DAX_ENUM, dax_param_enums), + fsparam_flag("file", OPT_FILE), {} }; @@ -133,6 +135,10 @@ static int virtio_fs_parse_param(struct fs_context *fsc, case OPT_DAX_ENUM: ctx->dax_mode = result.uint_32; break; + case OPT_FILE: + ctx->rootmode = S_IFREG; + ctx->rootmode_present = true; + break; default: return -EINVAL; } @@ -1401,7 +1407,8 @@ static const struct fuse_iqueue_ops virtio_fs_fiq_ops = { static inline void virtio_fs_ctx_set_defaults(struct fuse_fs_context *ctx) { - ctx->rootmode = S_IFDIR; + if (!ctx->rootmode_present) + ctx->rootmode = S_IFDIR; ctx->default_permissions = 1; ctx->allow_other = 1; ctx->max_read = UINT_MAX; From patchwork Tue Jul 9 11:19:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hanna Czenczek X-Patchwork-Id: 13727695 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 49A0915A4AF for ; Tue, 9 Jul 2024 11:19:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720523983; cv=none; b=dpua+R2Ol94i8MeIwxrb+l5ZFwbdr8zXVV+8fk2ZkMhLk2JO78xdlVbwKc4RFcR0EoqsPPsCdz5bpKEahRi6aRMOy+6LgpLaiHZjqVoUjF+RzyNDDVmwz7KwIfDZYXxz/53icPQjDDnM3dYll2J8KE1x5iJTYEGZhNXdJSTWUMs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720523983; c=relaxed/simple; bh=Xjz3MTVYq/NAB3daYzBwLF+8t3T7ssr4yfGhYIRspPk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SIREjzUobiakQRljaK3c4cRkFXMfSkiN0o26GLaZ9/t13s525m985rDpHF52fWCMGU9HGm1XIA/l2BXwp7ofVQUmeN3ndPrixWZ8+W78j30vIkr4yqy+v65IAj8zOH7XQuuLlHBy7Sm2OikPRNknoiOSG79pjyMCvjzhpnpnujo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=RIoi1ErR; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="RIoi1ErR" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1720523981; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YN0cRtZ4yjTFsrRdrBTPFQCjU2aNbe9nzOGwlrFJ09U=; b=RIoi1ErRETfh6dpZ6yUo1icvgk5JYEVBa1p1k4Vc2JgArS1RoVefFshq11UnyPDqA8nlcj SsAxcJRIRKquLEkiIc6hTfv3cFP/fxC7ketBBsp4+rjOh+rETJ8CSPG+yR1UzNN6/aedJE IIyE9roqFS14wtncNbiMgN7s6WDY4mE= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-271-ROJDlJx0Pkip0maN2EIhAw-1; Tue, 09 Jul 2024 07:19:39 -0400 X-MC-Unique: ROJDlJx0Pkip0maN2EIhAw-1 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-367987cff30so3418441f8f.1 for ; Tue, 09 Jul 2024 04:19:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720523978; x=1721128778; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YN0cRtZ4yjTFsrRdrBTPFQCjU2aNbe9nzOGwlrFJ09U=; b=XtQmv2C7aoLS+q+Yot7WIspbFedmZVcl/t8vb1z2zcEN6a+MvpGUd7xblME19o9xtN Qq6lXI+vX27cuTSQOcoUH1OCdDomA8UzWV1WHBj12O2WLfrq/Bra57NRQElW7dcX5DDu c52vWBNogwN4V3NucZpbTHixIA4m3LKWx+uFBrIrUPrTq4Iq8xToGe6K1UPiKkfJU00X m0vDp+6zKi5UB+odmuRyVzcqCPXzggiNkxclHYPn/DM16WUM+qd+iDvAP1clj/kGdMQB fX4eDq3HokMP3SK7qHQx6G6tGttBGKK7DKL8R0IBw+v54y4TJG6BwjYJrYt/HUzJUUac SnHw== X-Forwarded-Encrypted: i=1; AJvYcCXRn/AiHFB9ogQnv3DTYaBGOoaGthqzMrGD2alLPBfTXf+WwRFtAnU5GAnwq4TK2q3iWfSlwhmCqY5pLZJ9GAFbGRjgCL/fiJHzSEeL7w== X-Gm-Message-State: AOJu0YxEVjWCVlh4KAocUeoQ9+NrEOQHfgdvKyq9DeGm02V7RvxP71qI x6zp4T97Aw9CXaJqbRrtv54KXQjRHt9svpXiRISDfd4nSiUf334V2J58oZSm296n7el5ohiFJZi 89N/3OZupJZQSydGhEiNhdjYtzUVawyzhICec0N9X+GUTqLVhEkbFZm9bQBtAs0k= X-Received: by 2002:adf:f20b:0:b0:366:ecd1:2f38 with SMTP id ffacd0b85a97d-367cea45cb1mr1566737f8f.7.1720523978451; Tue, 09 Jul 2024 04:19:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFoGPU/A2758fnfW+6Bj1ZJdPWuqnkDg1NjoVhU3Nny/eh6gvsNgugn821lvXZApx4Cx1TO8g== X-Received: by 2002:adf:f20b:0:b0:366:ecd1:2f38 with SMTP id ffacd0b85a97d-367cea45cb1mr1566715f8f.7.1720523977994; Tue, 09 Jul 2024 04:19:37 -0700 (PDT) Received: from localhost (p200300cfd74b1c2b6d9a10b1cecd2745.dip0.t-ipconnect.de. [2003:cf:d74b:1c2b:6d9a:10b1:cecd:2745]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-367cde7e08asm2270192f8f.11.2024.07.09.04.19.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jul 2024 04:19:31 -0700 (PDT) From: Hanna Czenczek To: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-doc@vger.kernel.org, virtualization@lists.linux.dev Cc: Hanna Czenczek , Miklos Szeredi , German Maglione , Stefan Hajnoczi , =?utf-8?q?Eugenio_P=C3=A9rez?= , Jonathan Corbet , Vivek Goyal Subject: [PATCH 2/2] virtio-fs: Document 'file' mount option Date: Tue, 9 Jul 2024 13:19:18 +0200 Message-ID: <20240709111918.31233-3-hreitz@redhat.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240709111918.31233-1-hreitz@redhat.com> References: <20240709111918.31233-1-hreitz@redhat.com> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add the new mount option to the virtio-fs documentation. While at it, remove the note that virtio-fs would support FUSE mount options, because it does not. Signed-off-by: Hanna Czenczek --- Documentation/filesystems/virtiofs.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Documentation/filesystems/virtiofs.rst b/Documentation/filesystems/virtiofs.rst index fd4d2484e949..201ac9ee13c5 100644 --- a/Documentation/filesystems/virtiofs.rst +++ b/Documentation/filesystems/virtiofs.rst @@ -43,7 +43,10 @@ Mount options ------------- virtiofs supports general VFS mount options, for example, remount, -ro, rw, context, etc. It also supports FUSE mount options. +ro, rw, context, etc. + +The ``file`` mount option allows mounting a filesystem whose root node is not a +directory but a regular file. atime behavior ^^^^^^^^^^^^^^