Skip to contentSkip to conversation

vfs.git pile 2

GIT PULL Al Viro 3 participants 6 messages Dec 16, 2016 – Dec 18, 2016 VFS

lore
Share & tools
lore

Al Viro

author maintainer
#0 lore raw

In this pile:
* autofs-namespace series
* dedupe stuff
* more struct path constification

One conflict (xfs_reflink.c; resolved by taking this variant).

The following changes since commit 3e5de27e940d00d8d504dfb96625fb654f641509:

Linux 4.9-rc8 (2016-12-04 12:50:51 -0800)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git for-linus

for you to fetch changes up to 9763f7a4a5f7b1a7c480fa06d01b2bad25163c0a:

Merge branch 'work.autofs' into for-linus (2016-12-16 16:34:52 -0500)

----------------------------------------------------------------
Al Viro (21):
fsnotify: constify 'data' passed to ->handle_event() fsnotify(): constify 'data'
constify fsnotify_parent()
fsnotify: constify the places working with ->f_path audit_log_{name,link_denied}: constify struct path
constify get_dcookie() and friends
autofs: constify find_autofs_mount() callback
constify btrfs_mksubvol()
constify alloc_file()
quota: constify struct path in quota_on
namespace.c: constify struct path passed to a bunch of primitives
vfs: misc struct path constification
nfs_write_end(): fix handling of short copies
fix ceph_write_end()
fix gfs2_stuffed_write_end() on short copies
9p: saner ->write_end() on failing copy into non-uptodate page
exofs: don't mess with simple_write_{begin,end} simple_write_end(): don't zero in short copy into uptodate Merge branch 'work.write_end' into for-linus
Merge remote-tracking branch 'djwong/ocfs2-vfs-reflink-6' into for-linus Merge branch 'work.autofs' into for-linus

Christoph Hellwig (1):
fs: try to clone files first in vfs_copy_file_range

Darrick J. Wong (10):
vfs: refactor clone/dedupe_file_range common functions
ocfs2: convert inode refcount test to a helper
ocfs2: add newlines to some error messages
ocfs2: prohibit refcounted swapfiles
ocfs2: budget for extent tree splits when adding refcount flag
ocfs2: don't eat io errors during _dio_end_io_write
ocfs2: always unlock when completing dio writes
ocfs2: fix bad pointer cast
ocfs2: charge quota for reflinked blocks
ocfs2: implement the VFS clone_range, copy_range, and dedupe_range features

Ian Kent (10):
vfs: change d_manage() to take a struct path
vfs: add path_is_mountpoint() helper
vfs: add path_has_submounts()
autofs: change autofs4_expire_wait()/do_expire_wait() to take struct path
autofs: change autofs4_wait() to take struct path
autofs: use path_is_mountpoint() to fix unreliable d_mountpoint() checks
autofs: use path_has_submounts() to fix unreliable have_submount() checks
vfs: remove unused have_submounts() function
autofs - constify misc struct path instances
autofs - dont hold spin lock over direct mount expire

Micka�l Sala�n (1):
fs: Constify path_is_under()'s arguments

 Documentation/filesystems/Locking          |   2 +-
 Documentation/filesystems/vfs.txt          |   2 +-
 arch/powerpc/oprofile/cell/spu_task_sync.c |   2 +-
 drivers/oprofile/buffer_sync.c             |   2 +-
 fs/9p/vfs_addr.c                           |  15 +-
 fs/autofs4/autofs_i.h                      |   5 +-
 fs/autofs4/dev-ioctl.c                     |  10 +-
 fs/autofs4/expire.c                        |  25 +-
 fs/autofs4/root.c                          |  61 ++--
 fs/autofs4/waitq.c                         |  13 +-
 fs/btrfs/ctree.h                           |   3 -
 fs/btrfs/file.c                            |   1 -
 fs/btrfs/ioctl.c                           |  14 +-
 fs/ceph/addr.c                             |  14 +-
 fs/dcache.c                                |  40 +--
 fs/dcookies.c                              |   4 +-
 fs/exofs/inode.c                           |  68 ++---
 fs/ext4/super.c                            |   4 +-
 fs/file_table.c                            |   2 +-
 fs/gfs2/aops.c                             |   4 +-
 fs/internal.h                              |   2 +-
 fs/libfs.c                                 |  14 +-
 fs/mount.h                                 |   6 +
 fs/namei.c                                 |  17 +-
 fs/namespace.c                             |  39 ++-
 fs/nfs/file.c                              |   2 +-
 fs/notify/dnotify/dnotify.c                |   2 +-
 fs/notify/fanotify/fanotify.c              |   8 +-
 fs/notify/fanotify/fanotify.h              |   2 +-
 fs/notify/fsnotify.c                       |   8 +-
 fs/notify/inotify/inotify.h                |   2 +-
 fs/notify/inotify/inotify_fsnotify.c       |   4 +-
 fs/ocfs2/alloc.c                           |   7 +-
 fs/ocfs2/aops.c                            |  31 +-
 fs/ocfs2/file.c                            |  42 ++-
 fs/ocfs2/file.h                            |   3 +
 fs/ocfs2/inode.h                           |   6 +
 fs/ocfs2/move_extents.c                    |  10 +-
 fs/ocfs2/refcounttree.c                    | 464 ++++++++++++++++++++++++++++-
 fs/ocfs2/refcounttree.h                    |   7 +
 fs/ocfs2/xattr.c                           |   4 +-
 fs/quota/dquot.c                           |   2 +-
 fs/quota/quota.c                           |   4 +-
 fs/read_write.c                            | 231 +++++++++++++-
 fs/reiserfs/super.c                        |   4 +-
 fs/statfs.c                                |   2 +-
 fs/utimes.c                                |   2 +-
 fs/xfs/xfs_file.c                          |  19 --
 fs/xfs/xfs_reflink.c                       | 213 +------------
 include/linux/audit.h                      |   2 +-
 include/linux/dcache.h                     |   4 +-
 include/linux/dcookies.h                   |   4 +-
 include/linux/file.h                       |   2 +-
 include/linux/fs.h                         |  12 +-
 include/linux/fsnotify.h                   |  12 +-
 include/linux/fsnotify_backend.h           |  10 +-
 include/linux/mount.h                      |   6 +-
 include/linux/quota.h                      |   2 +-
 include/linux/quotaops.h                   |   2 +-
 kernel/audit.c                             |   4 +-
 kernel/audit.h                             |   2 +-
 kernel/audit_fsnotify.c                    |  10 +-
 kernel/audit_tree.c                        |   2 +-
 kernel/audit_watch.c                       |   8 +-
 64 files changed, 1027 insertions(+), 503 deletions(-)
#1 lore raw
Quoted 4 lines · Al Viro

In this pile:
* autofs-namespace series
* dedupe stuff
* more struct path constification

When looking at the conflict, I looked at that part of vfs_clone_file_prep_inodes(), and reacted to the insanity.

WTF?

        /* Zero length dedupe exits immediately; reflink goes to EOF. */
        if (*len == 0) {
                if (is_dedupe) {
                        *len = 0;
                        return 0;
                }
                *len = isize - pos_in;
        }

I'll just leave you to read through that part a bit more. Because there are two completely insane things going on in that code sequence.

Linus

author maintainer
#2 lore raw

[Darrick Cc'd]

Quoted 20 lines · Linus Torvalds
Quoted 4 lines · Al Viro

In this pile:
* autofs-namespace series
* dedupe stuff
* more struct path constification

When looking at the conflict, I looked at that part of vfs_clone_file_prep_inodes(), and reacted to the insanity.

WTF?

        /* Zero length dedupe exits immediately; reflink goes to EOF. */
        if (*len == 0) {
                if (is_dedupe) {
                        *len = 0;
                        return 0;
                }
                *len = isize - pos_in;
        }
Quoted 2 lines

I'll just leave you to read through that part a bit more. Because there are two completely insane things going on in that code sequence.

One, AFAICS - pointless *len = 0 in case of is_dedupe. That's a counterpart of

	/* Zero length dedupe exits immediately; reflink goes to EOF. */
	if (len == 0) {
		if (is_dedupe) {
			ret = 0;
			goto out_unlock;
		}
		len = isize - pos_in;
	}

in mainline xfs_reflink_remap_range(). What else am I missing there? I'm not thrilled with the calling conventions they'd used, and that *len = 0; shouldn't have been slapped there (at a guess, by inertia from the conversion of the chunk right before that one -

	/* Are we going all the way to the end? */
	isize = i_size_read(inode_in);
	if (isize == 0) {
		ret = 0;
		goto out_unlock;
	}

in mainline, needing *len = 0; after conversion), but I don't see what else are you refering to in that snippet...

#3 lore raw
Quoted 2 lines · Al Viro

One, AFAICS - pointless *len = 0 in case of is_dedupe.

Yup.

That part made sense in the original code where len and ret were different. Now it just looks like a five-year old has been eating crayons and paste.

Quoted 1 line

What else am I missing there?

I absolutely *abhor* this part:

                *len = isize - pos_in;

because the whole code then depends on the overflow checking a few lines down, and it's not at all obvious. We have not tested that "pos_in" is smaller than "isize", even though the comment above the "isize == 0" test inplies we did some kind of "past the end check" (we did not).

The whole "depend on overflow checking" being nasty is particularly true when that checking itself is damn subtle, and depends deeply on the type of "*len" being unsigned and larger than "loff_t". Which in turn is true, but it's all really nasty, and it's subtle. "loff_t" is "long long", while "*len" is u64, and it's almost just luck that the comparison does in fact end up unsigned.

So I think that code really needs a fair amount of loving.

Linus

author maintainer
#4 lore raw
Quoted 12 lines · Linus Torvalds
Quoted 1 line

What else am I missing there?

I absolutely *abhor* this part:

                *len = isize - pos_in;

because the whole code then depends on the overflow checking a few lines down, and it's not at all obvious. We have not tested that "pos_in" is smaller than "isize", even though the comment above the "isize == 0" test inplies we did some kind of "past the end check" (we did not).

Quoted 6 lines

The whole "depend on overflow checking" being nasty is particularly true when that checking itself is damn subtle, and depends deeply on the type of "*len" being unsigned and larger than "loff_t". Which in turn is true, but it's all really nasty, and it's subtle. "loff_t" is "long long", while "*len" is u64, and it's almost just luck that the comparison does in fact end up unsigned.

I agree, but that one is a straight move - exact same thing is there in xfs_reflink.c counterpart in the current mainline.

Quoted 1 line

So I think that code really needs a fair amount of loving.

Indeed. Darrick, would you add a followup cleaning that up? It can be done after the move to fs/read_write.c - no need to reorder/rebase that thing. While we are at it, it might be better to turn the return value into -E.../0/1, 0 being "no error, but nothing to do" and 1 - the normal success case. That would get rid of using *len = 0 as signalling mechanism - the caller would simply do

	ret = vfs_..._inodes(.....);
	if (ret <= 0)
		goto out_unlock;
	/* returned positive, we have work to do */
#5 lore raw
Quoted 20 lines · Al Viro
Quoted 12 lines · Linus Torvalds
Quoted 1 line

What else am I missing there?

I absolutely *abhor* this part:

                *len = isize - pos_in;

because the whole code then depends on the overflow checking a few lines down, and it's not at all obvious. We have not tested that "pos_in" is smaller than "isize", even though the comment above the "isize == 0" test inplies we did some kind of "past the end check" (we did not).

Quoted 6 lines

The whole "depend on overflow checking" being nasty is particularly true when that checking itself is damn subtle, and depends deeply on the type of "*len" being unsigned and larger than "loff_t". Which in turn is true, but it's all really nasty, and it's subtle. "loff_t" is "long long", while "*len" is u64, and it's almost just luck that the comparison does in fact end up unsigned.

Quoted 2 lines

I agree, but that one is a straight move - exact same thing is there in xfs_reflink.c counterpart in the current mainline.

Ok, fair enough. I thought it was ok but then I've spent so much time staring at the reflink code it's good to have a fresh set of eyes. :) I'll add a if (pos_in > isize) return -EINVAL there to make it more explicit.

Quoted 8 lines
Quoted 1 line

So I think that code really needs a fair amount of loving.

Indeed. Darrick, would you add a followup cleaning that up? It can be done after the move to fs/read_write.c - no need to reorder/rebase that thing. While we are at it, it might be better to turn the return value into -E.../0/1, 0 being "no error, but nothing to do" and 1 - the normal success case. That would get rid of using *len = 0 as signalling mechanism - the caller would simply do

Quoted 4 lines
	ret = vfs_..._inodes(.....);
	if (ret <= 0)
		goto out_unlock;
	/* returned positive, we have work to do */

Sounds good. I'll post a cleanup patch once it goes through the xfstests wringer.

--D