<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/fs/overlayfs/util.c, branch linux-6.7.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.7.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.7.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2024-02-01T00:21:11Z</updated>
<entry>
<title>ovl: mark xwhiteouts directory with overlay.opaque='x'</title>
<updated>2024-02-01T00:21:11Z</updated>
<author>
<name>Amir Goldstein</name>
</author>
<published>2024-01-20T10:18:39Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=eedc92622b102943c4c1e483c6e07b936106e936'/>
<id>urn:sha1:eedc92622b102943c4c1e483c6e07b936106e936</id>
<content type='text'>
commit 420332b94119cdc7db4477cc88484691cb92ae71 upstream.

An opaque directory cannot have xwhiteouts, so instead of marking an
xwhiteouts directory with a new xattr, overload overlay.opaque xattr
for marking both opaque dir ('y') and xwhiteouts dir ('x').

This is more efficient as the overlay.opaque xattr is checked during
lookup of directory anyway.

This also prevents unnecessary checking the xattr when reading a
directory without xwhiteouts, i.e. most of the time.

Note that the xwhiteouts marker is not checked on the upper layer and
on the last layer in lowerstack, where xwhiteouts are not expected.

Fixes: bc8df7a3dc03 ("ovl: Add an alternative type of whiteout")
Cc: &lt;stable@vger.kernel.org&gt; # v6.7
Reviewed-by: Alexander Larsson &lt;alexl@redhat.com&gt;
Tested-by: Alexander Larsson &lt;alexl@redhat.com&gt;
Signed-off-by: Amir Goldstein &lt;amir73il@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>ovl: fix misformatted comment</title>
<updated>2023-11-14T06:09:36Z</updated>
<author>
<name>Amir Goldstein</name>
</author>
<published>2023-11-12T09:12:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b28060db7172e6d8912d88b369123eb89e0d36b4'/>
<id>urn:sha1:b28060db7172e6d8912d88b369123eb89e0d36b4</id>
<content type='text'>
Remove misleading /** prefix from a regular comment.

Reported-by: kernel test robot &lt;lkp@intel.com&gt;
Closes: https://lore.kernel.org/oe-kbuild-all/202311121628.byHp8tkv-lkp@intel.com/
Signed-off-by: Amir Goldstein &lt;amir73il@gmail.com&gt;
</content>
</entry>
<entry>
<title>Merge tag 'vfs-6.7.fsid' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs</title>
<updated>2023-11-07T20:11:26Z</updated>
<author>
<name>Linus Torvalds</name>
</author>
<published>2023-11-07T20:11:26Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=13d88ac54ddd1011b6e94443958e798aa06eb835'/>
<id>urn:sha1:13d88ac54ddd1011b6e94443958e798aa06eb835</id>
<content type='text'>
Pull vfs fanotify fsid updates from Christian Brauner:
 "This work is part of the plan to enable fanotify to serve as a drop-in
  replacement for inotify. While inotify is availabe on all filesystems,
  fanotify currently isn't.

  In order to support fanotify on all filesystems two things are needed:

   (1) all filesystems need to support AT_HANDLE_FID

   (2) all filesystems need to report a non-zero f_fsid

  This contains (1) and allows filesystems to encode non-decodable file
  handlers for fanotify without implementing any exportfs operations by
  encoding a file id of type FILEID_INO64_GEN from i_ino and
  i_generation.

  Filesystems that want to opt out of encoding non-decodable file ids
  for fanotify that don't support NFS export can do so by providing an
  empty export_operations struct.

  This also partially addresses (2) by generating f_fsid for simple
  filesystems as well as freevxfs. Remaining filesystems will be dealt
  with by separate patches.

  Finally, this contains the patch from the current exportfs maintainers
  which moves exportfs under vfs with Chuck, Jeff, and Amir as
  maintainers and vfs.git as tree"

* tag 'vfs-6.7.fsid' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs:
  MAINTAINERS: create an entry for exportfs
  fs: fix build error with CONFIG_EXPORTFS=m or not defined
  freevxfs: derive f_fsid from bdev-&gt;bd_dev
  fs: report f_fsid from s_dev for "simple" filesystems
  exportfs: support encoding non-decodeable file handles by default
  exportfs: define FILEID_INO64_GEN* file handle types
  exportfs: make -&gt;encode_fh() a mandatory method for NFS export
  exportfs: add helpers to check if filesystem can encode/decode file handles
</content>
</entry>
<entry>
<title>ovl: Add an alternative type of whiteout</title>
<updated>2023-10-30T22:12:59Z</updated>
<author>
<name>Alexander Larsson</name>
</author>
<published>2023-08-23T14:33:42Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=bc8df7a3dc035903426a17ea3027f55817de13a8'/>
<id>urn:sha1:bc8df7a3dc035903426a17ea3027f55817de13a8</id>
<content type='text'>
An xattr whiteout (called "xwhiteout" in the code) is a reguar file of
zero size with the "overlay.whiteout" xattr set. A file like this in a
directory with the "overlay.whiteouts" xattrs set will be treated the
same way as a regular whiteout.

The "overlay.whiteouts" directory xattr is used in order to
efficiently handle overlay checks in readdir(), as we only need to
checks xattrs in affected directories.

The advantage of this kind of whiteout is that they can be escaped
using the standard overlay xattr escaping mechanism. So, a file with a
"overlay.overlay.whiteout" xattr would be unescaped to
"overlay.whiteout", which could then be consumed by another overlayfs
as a whiteout.

Overlayfs itself doesn't create whiteouts like this, but a userspace
mechanism could use this alternative mechanism to convert images that
may contain whiteouts to be used with overlayfs.

To work as a whiteout for both regular overlayfs mounts as well as
userxattr mounts both the "user.overlay.whiteout*" and the
"trusted.overlay.whiteout*" xattrs will need to be created.

Signed-off-by: Alexander Larsson &lt;alexl@redhat.com&gt;
Reviewed-by: Amir Goldstein &lt;amir73il@gmail.com&gt;
Signed-off-by: Amir Goldstein &lt;amir73il@gmail.com&gt;
</content>
</entry>
<entry>
<title>ovl: do not encode lower fh with upper sb_writers held</title>
<updated>2023-10-30T22:12:57Z</updated>
<author>
<name>Amir Goldstein</name>
</author>
<published>2023-08-16T13:47:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5b02bfc1e7e3811c5bf7f0fa626a0694d0dbbd77'/>
<id>urn:sha1:5b02bfc1e7e3811c5bf7f0fa626a0694d0dbbd77</id>
<content type='text'>
When lower fs is a nested overlayfs, calling encode_fh() on a lower
directory dentry may trigger copy up and take sb_writers on the upper fs
of the lower nested overlayfs.

The lower nested overlayfs may have the same upper fs as this overlayfs,
so nested sb_writers lock is illegal.

Move all the callers that encode lower fh to before ovl_want_write().

Signed-off-by: Amir Goldstein &lt;amir73il@gmail.com&gt;
</content>
</entry>
<entry>
<title>ovl: do not open/llseek lower file with upper sb_writers held</title>
<updated>2023-10-30T22:12:57Z</updated>
<author>
<name>Amir Goldstein</name>
</author>
<published>2023-08-16T09:42:18Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c63e56a4a6523fcb1358e1878607d77a40b534bb'/>
<id>urn:sha1:c63e56a4a6523fcb1358e1878607d77a40b534bb</id>
<content type='text'>
overlayfs file open (ovl_maybe_lookup_lowerdata) and overlay file llseek
take the ovl_inode_lock, without holding upper sb_writers.

In case of nested lower overlay that uses same upper fs as this overlay,
lockdep will warn about (possibly false positive) circular lock
dependency when doing open/llseek of lower ovl file during copy up with
our upper sb_writers held, because the locking ordering seems reverse to
the locking order in ovl_copy_up_start():

- lower ovl_inode_lock
- upper sb_writers

Let the copy up "transaction" keeps an elevated mnt write count on upper
mnt, but leaves taking upper sb_writers to lower level helpers only when
they actually need it.  This allows to avoid holding upper sb_writers
during lower file open/llseek and prevents the lockdep warning.

Minimizing the scope of upper sb_writers during copy up is also needed
for fixing another possible deadlocks by a following patch.

Signed-off-by: Amir Goldstein &lt;amir73il@gmail.com&gt;
</content>
</entry>
<entry>
<title>ovl: reorder ovl_want_write() after ovl_inode_lock()</title>
<updated>2023-10-30T22:12:57Z</updated>
<author>
<name>Amir Goldstein</name>
</author>
<published>2023-07-20T09:51:21Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=162d06444070c12827d604a2cb6b6bd98d48cbb0'/>
<id>urn:sha1:162d06444070c12827d604a2cb6b6bd98d48cbb0</id>
<content type='text'>
Make the locking order of ovl_inode_lock() strictly between the two
vfs stacked layers, i.e.:
- ovl vfs locks: sb_writers, inode_lock, ...
- ovl_inode_lock
- upper vfs locks: sb_writers, inode_lock, ...

To that effect, move ovl_want_write() into the helpers ovl_nlink_start()
and ovl_copy_up_start which currently take the ovl_inode_lock() after
ovl_want_write().

Signed-off-by: Amir Goldstein &lt;amir73il@gmail.com&gt;
</content>
</entry>
<entry>
<title>ovl: split ovl_want_write() into two helpers</title>
<updated>2023-10-30T22:12:57Z</updated>
<author>
<name>Amir Goldstein</name>
</author>
<published>2023-08-16T09:18:15Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d08d3b3c2caf6c482703bbc5efaa7b9ae95dea20'/>
<id>urn:sha1:d08d3b3c2caf6c482703bbc5efaa7b9ae95dea20</id>
<content type='text'>
ovl_get_write_access() gets write access to upper mnt without taking
freeze protection on upper sb and ovl_start_write() only takes freeze
protection on upper sb.

These helpers will be used to breakup the large ovl_want_write() scope
during copy up into finer grained freeze protection scopes.

Signed-off-by: Amir Goldstein &lt;amir73il@gmail.com&gt;
</content>
</entry>
<entry>
<title>ovl: protect copying of realinode attributes to ovl inode</title>
<updated>2023-10-30T22:12:55Z</updated>
<author>
<name>Amir Goldstein</name>
</author>
<published>2023-08-24T11:51:17Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=f7621b11e8acc8efa208c9420ff3ecb198b20e29'/>
<id>urn:sha1:f7621b11e8acc8efa208c9420ff3ecb198b20e29</id>
<content type='text'>
ovl_copyattr() may be called concurrently from aio completion context
without any lock and that could lead to overlay inode attributes getting
permanently out of sync with real inode attributes.

Use ovl inode spinlock to protect ovl_copyattr().

Signed-off-by: Amir Goldstein &lt;amir73il@gmail.com&gt;
</content>
</entry>
<entry>
<title>exportfs: add helpers to check if filesystem can encode/decode file handles</title>
<updated>2023-10-24T15:57:45Z</updated>
<author>
<name>Amir Goldstein</name>
</author>
<published>2023-10-23T18:07:58Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=66c62769bcf6aa142e2309278980a2e52f4b08db'/>
<id>urn:sha1:66c62769bcf6aa142e2309278980a2e52f4b08db</id>
<content type='text'>
The logic of whether filesystem can encode/decode file handles is open
coded in many places.

In preparation to changing the logic, move the open coded logic into
inline helpers.

Reviewed-by: Jan Kara &lt;jack@suse.cz&gt;
Reviewed-by: Jeff Layton &lt;jlayton@kernel.org&gt;
Signed-off-by: Amir Goldstein &lt;amir73il@gmail.com&gt;
Link: https://lore.kernel.org/r/20231023180801.2953446-2-amir73il@gmail.com
Signed-off-by: Christian Brauner &lt;brauner@kernel.org&gt;
</content>
</entry>
</feed>
