Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 692204 - >=sys-kernel/gentoo-sources-5.0 - add shiftfs support
Summary: >=sys-kernel/gentoo-sources-5.0 - add shiftfs support
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal with 1 vote (vote)
Assignee: Gentoo Kernel Bug Wranglers and Kernel Maintainers
Depends on:
Reported: 2019-08-15 10:28 UTC by fling
Modified: 2021-01-09 18:28 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---

Shiftfs Patch for 5.4.87 (5000_shifts-ubuntu-20.04.patch,54.16 KB, patch)
2021-01-07 13:10 UTC, Mike Pagano
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description fling 2019-08-15 10:28:49 UTC
sys-kernel/gentoo-sources is missing shiftfs support

shiftfs support could be added with a masked use flag by patching gentoo-sources with diffs extracted from like this:

n=5001 ; for c in $(git log fs/shiftfs.c | grep ^commit | sed s/commit\ // | tac) ; do git format-patch -1 --start-number $n $c ; n=$(($n+1)) ; done

shiftfs works with linux 5.0, 5.1 and 5.2.
I tested these patches successfully with =sys-kernel/gentoo-sources-5.1.21.
Comment 1 Mike Pagano gentoo-dev 2019-08-16 18:04:41 UTC
I thinking this is a candidate for the 'experimental' use flag.
Comment 2 Mike Pagano gentoo-dev 2019-08-16 18:05:27 UTC
Can you test with 5.2, as 5.1 is EOL'd and 5.0 is long gone.
Comment 3 fling 2019-08-17 03:13:13 UTC
(In reply to Mike Pagano from comment #2)
> Can you test with 5.2, as 5.1 is EOL'd and 5.0 is long gone.

I extracted it from 5.2 repo btw.
Going to test the patches with 5.2 soon, waiting for the release of zfs 0.8.2 which adds 5.2 support.
Comment 4 fling 2019-08-24 06:51:28 UTC
Tested with 5.1 and lxd 3.16 from
Everything works as expected.
Comment 5 fling 2019-08-24 09:16:20 UTC
(In reply to Mike Pagano from comment #2)
> Can you test with 5.2, as 5.1 is EOL'd and 5.0 is long gone.

Tested with gentoo-sources-5.2.9, everything works as expected.
Comment 6 Mike Pagano gentoo-dev 2019-10-16 18:34:28 UTC
Sorry for slacking on this.

Would getting the patches from this git repo provide the support that is needed rather than from Ubuntu ?
Comment 7 Daniel Ziółkowski 2019-11-13 11:06:45 UTC
Ubuntu has more patches pertaining to shiftfs, the linuxkit repository might be rather outdated.
Comment 8 fling 2019-11-26 13:36:18 UTC
5.4 patches located at git:// for now
Comment 9 Mike Pagano gentoo-dev 2020-01-09 00:09:45 UTC
(In reply to fling from comment #8)
> 5.4 patches located at
> git://
> for now

Is there something showing which patches are part of shitfs ?
Comment 10 Francesco Riosa 2020-10-06 20:58:48 UTC
Ubuntu also modified OverlayFS to cooperate with ShiftFS
The patches are pretty recognizable, but I'm not sure a distro (gentoo) should rely on his hackish porting of patches, I will probably use it on my own kernel tough, so thankyou Fling.

List of patches for 5.8:
git log --pretty=tformat:"%H %s" fs/ | grep shiftfs

fd79a5b629d3fa2104b2b847e58930d55ecb2cd1 UBUNTU: SAUCE: shiftfs: prevent ESTALE for LOOKUP_JUMP lookups
22bb84cb8794758d24efea9920dd2eda8edf431e UBUNTU: SAUCE: Revert "UBUNTU: SAUCE: shiftfs: fix dentry revalidation"
f1a412a7e62ded49e86782bbfe068b984e4622de UBUNTU: SAUCE: shiftfs -- Fix build errors from missing fiemap definitions
8dd5a6951352d1db8cc426586bc54e7a7a03b3bf Revert "UBUNTU: SAUCE: overlayfs: use shiftfs hacks only with shiftfs as underlay"
307658071f5860748c5fe9930b75c8d285002ea3 UBUNTU: SAUCE: shiftfs: let userns root destroy subvolumes from other users
102ff48452f387031f9ef1263d0c4249f873ec07 UBUNTU: SAUCE: overlayfs: use shiftfs hacks only with shiftfs as underlay
25a3522a1cdc1fb82d0c1c43c795f1bcf23826aa UBUNTU: SAUCE: shiftfs: fix dentry revalidation
a72950138baa2718c3c96af53660b85298cc201e UBUNTU: SAUCE: shiftfs: record correct creator credentials
895897a4d1527482764dbb472644330ceddc359c UBUNTU: SAUCE: shiftfs: prevent lower dentries from going negative during unlink
9143853f23aac585cb1c0754eeb93b1860aed998 UBUNTU: SAUCE: shiftfs: Correct id translation for lower fs operations
c64361e737f7693d080269553ad454324cbab76a UBUNTU: SAUCE: shiftfs: prevent type confusion
6c21bbce87a3742ae3dcf50804bc86b45e73024d UBUNTU: SAUCE: shiftfs: Fix refcount underflow in btrfs ioctl handling
6f3ac54d9b188a74a7606e6e31a10baaa4607626 UBUNTU: SAUCE: shiftfs: drop CAP_SYS_RESOURCE from effective capabilities
5f195e2bd5183d4e11f5c20e60cb319057f1c01c UBUNTU: SAUCE: shiftfs: setup correct s_maxbytes limit
fb2ae3d90b2af578d768a2339c97600d7f5379f1 UBUNTU: SAUCE: shiftfs: Restore vm_file value when lower fs mmap fails
81ba1d42d9346fa0ffae737010f690e7b447e706 UBUNTU: SAUCE: overlayfs: allow with shiftfs as underlay
ce055e2f5f4a3c35e61e4d7cb6b3a94a6bbb997b UBUNTU: SAUCE: shiftfs: rework how shiftfs opens files
51d83babf55143d58bdebbe9a955e9e99b11ad2b UBUNTU: SAUCE: shiftfs: mark slab objects SLAB_RECLAIM_ACCOUNT
5e07b8b60379c1f27219d7aa472021406d37ab4c UBUNTU: SAUCE: shiftfs: fix buggy unlink logic
bf557b085d5c3b3358199bba56459bc06bc0bc53 UBUNTU: SAUCE: shiftfs: pass correct point down
53586bc9efa92d6e5ec0f3933624fed35594c9bd UBUNTU: SAUCE: shiftfs: add O_DIRECT support
d28e4da3bb96a75429336c8c950d55ffd9d0ea25 UBUNTU: SAUCE: shiftfs: allow changing ro/rw for subvolumes
93b0ebcf8d084d5cc8881c40a5134b9c78c15b77 UBUNTU: SAUCE: shiftfs: lock down certain superblock flags
f4d3476a099f456f101fdc96eea0844dfe121c3c UBUNTU: SAUCE: shiftfs: use separate llseek method for directories
474a18df9caed16278e5231f84f8d25dfee5b7f0 UBUNTU: SAUCE: shiftfs: prevent use-after-free when verifying mount options
d665fec51b0e9979168c06035d1a022979955e0b UBUNTU: SAUCE: shiftfs: fix passing of attrs to underaly for setattr
de21c4356b90f1f23b40fb11e889023599bb15fa UBUNTU: SAUCE: shiftfs: use translated ids when chaning lower fs attrs
93091621be96e01cfc580c8263f8c135c5207bbc UBUNTU: SAUCE: shiftfs: support some btrfs ioctls
b63e321c486ab78acb0e2eac880b1c2c864a32ca UBUNTU: SAUCE: shiftfs: rework and extend
b1c9ba60e228f4fc6ccd91c3614ba090c639a93e UBUNTU: SAUCE: shiftfs: uid/gid shifting bind mount
Comment 11 Mike Pagano gentoo-dev 2021-01-07 13:10:25 UTC
Created attachment 681631 [details, diff]
Shiftfs Patch for 5.4.87

Fling, can you test this patch. It's from Ubuntu's 5.4 kernel patchset.  I haven't tried applying it against 5.10.  

Can you test with 5.4.X ?
Comment 12 Larry the Git Cow gentoo-dev 2021-01-09 18:28:12 UTC
The bug has been closed via the following commit(s):

commit dbe7b9fee2684ad0cc0b3015c9e1d16506d4c078
Author:     Mike Pagano <>
AuthorDate: 2021-01-09 18:28:05 +0000
Commit:     Mike Pagano <>
CommitDate: 2021-01-09 18:28:05 +0000

    sys-kernel/gentoo-sources: Linux patch 5.10.6 and add support for shiftfs
    Package-Manager: Portage-3.0.12, Repoman-3.0.2
    Signed-off-by: Mike Pagano <>

 sys-kernel/gentoo-sources/Manifest                 |  3 +++
 .../gentoo-sources/gentoo-sources-5.10.6.ebuild    | 28 ++++++++++++++++++++++
 2 files changed, 31 insertions(+)