* [git pull] vfs.git, part 1
@ 2013-07-01 19:59 Al Viro
2013-08-01 9:00 ` Christoph Hellwig
0 siblings, 1 reply; 12+ messages in thread
From: Al Viro @ 2013-07-01 19:59 UTC (permalink / raw)
To: Linus Torvalds; +Cc: linux-kernel, linux-fsdevel
The major change in that pile is ->readdir() replacement with ->iterate(),
dealing with ->f_pos races in ->readdir() instances for good. There's
a lot more, but I'd prefer to split the pull request into several stages
and this is the first obvious cutoff point. Please, pull from the
usual place -
git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git for-linus
Shortlog:
Al Viro (67):
consolidate io_remap_pfn_range definitions
samsung: don't bother with setting VM_IO
hose_mmap_page_range(): io_remap_pfn_range() will set all those flags...
mn10300: don't bother with VM_IO
sparc: __pci_mmap_set_flags() is useless
drm: io_remap_pfn_range() sets VM_IO...
i810: VM_IO is set by io_remap_pfn_range()
vfio: remap_pfn_range() sets all those flags...
au1200fb: io_remap_pfn_range() sets VM_IO
au1100fb: VM_IO is set by io_remap_pfn_range()
pxa3xx: VM_IO is set by io_remap_pfn_range()
compat.c: LOOP_CLR_FD is taken care of in loop.c itself...
move linux/loop.h to drivers/block
[readdir] introduce iterate_dir() and dir_context
[readdir] introduce ->iterate(), ctx->pos, dir_emit()
[readdir] simple local unixlike: switch to ->iterate()
[readdir] switch dcache_readdir() users to ->iterate()
[readdir] convert ext3
[readdir] convert udf
[readdir] convert ubifs
[readdir] convert squashfs
[readdir] convert romfs
[readdir] convert configfs
[readdir] convert efs
[readdir] convert openpromfs
[readdir] convert procfs
[readdir] convert bfs
[readdir] convert exofs
[readdir] convert gfs2
[readdir] convert sysfs
[readdir] convert nilfs2
[readdir] convert omfs
[readdir] convert qnx4
[readdir] convert qnx6
[readdir] convert ext4
[readdir] convert nfs
[readdir] convert ceph
[readdir] convert jfs
[readdir] convert logfs
[readdir] convert adfs
[readdir] convert affs
[readdir] convert 9p
[readdir] convert f2fs
[readdir] convert jffs2
[readdir] convert isofs
[readdir] convert ntfs
[readdir] convert reiserfs
reiserfs: is_privroot_deh() needs only directory inode, actually
reiserfs: switch reiserfs_readdir_dentry to inode
[readdir] convert hpfs
[readdir] convert fuse
[readdir] convert freevxfs
[readdir] convert cifs
[readdir] convert befs
[readdir] convert hfs
[readdir] convert hfsplus
[readdir] convert ncpfs
[readdir] convert afs
[readdir] convert hostfs
[readdir] convert btrfs
[readdir] convert xfs
[readdir] convert fatfs
[readdir] convert ocfs2
[readdir] convert coda
[readdir] convert ecryptfs
[readdir] ->readdir() is gone
[readdir] constify ->actor
Artem Bityutskiy (2):
UBIFS: prepare to fix a horrid bug
UBIFS: fix a horrid bug
Diffstat:
Documentation/filesystems/Locking | 2 +-
Documentation/filesystems/porting | 6 +
Documentation/filesystems/vfs.txt | 4 +-
arch/alpha/include/asm/pgtable.h | 3 -
arch/alpha/kernel/osf_sys.c | 15 +-
arch/alpha/kernel/pci-sysfs.c | 1 -
arch/arc/include/asm/pgtable.h | 3 -
arch/arm/include/asm/pgtable-nommu.h | 2 -
arch/arm/include/asm/pgtable.h | 7 -
arch/arm64/include/asm/pgtable.h | 7 -
arch/avr32/include/asm/pgtable.h | 3 -
arch/blackfin/include/asm/pgtable.h | 1 -
arch/c6x/include/asm/pgtable.h | 1 -
arch/cris/include/asm/pgtable.h | 3 -
arch/frv/include/asm/pgtable.h | 3 -
arch/h8300/include/asm/pgtable.h | 3 -
arch/hexagon/include/asm/pgtable.h | 4 -
arch/ia64/include/asm/pgtable.h | 3 -
arch/m32r/include/asm/pgtable.h | 3 -
arch/m68k/include/asm/pgtable_mm.h | 3 -
arch/m68k/include/asm/pgtable_no.h | 3 -
arch/metag/include/asm/pgtable.h | 3 -
arch/microblaze/include/asm/pgtable.h | 3 -
arch/mips/include/asm/pgtable.h | 4 +-
arch/mn10300/include/asm/pgtable.h | 3 -
arch/mn10300/unit-asb2305/pci-asb2305.c | 2 +-
arch/openrisc/include/asm/pgtable.h | 3 -
arch/parisc/hpux/fs.c | 16 +-
arch/parisc/include/asm/pgtable.h | 3 -
arch/powerpc/include/asm/pgtable.h | 3 -
arch/powerpc/platforms/cell/spufs/inode.c | 2 +-
arch/s390/include/asm/pgtable.h | 3 -
arch/score/include/asm/pgtable.h | 3 -
arch/sh/include/asm/pgtable.h | 3 -
arch/sparc/include/asm/pgtable_32.h | 1 +
arch/sparc/include/asm/pgtable_64.h | 1 +
arch/sparc/kernel/pci.c | 10 -
arch/tile/include/asm/pgtable.h | 3 -
arch/um/include/asm/pgtable.h | 2 -
arch/unicore32/include/asm/pgtable.h | 7 -
arch/x86/include/asm/pgtable.h | 3 -
arch/xtensa/include/asm/pgtable.h | 8 -
drivers/block/cryptoloop.c | 2 +-
drivers/block/loop.c | 2 +-
{include/linux => drivers/block}/loop.h | 2 +-
drivers/gpu/drm/drm_vm.c | 1 -
drivers/gpu/drm/i810/i810_dma.c | 2 +-
drivers/vfio/pci/vfio_pci.c | 1 -
drivers/video/au1100fb.c | 2 -
drivers/video/au1200fb.c | 4 -
drivers/video/pxa3xx-gcu.c | 1 -
fs/9p/vfs_dir.c | 72 +++----
fs/adfs/dir.c | 42 ++--
fs/affs/dir.c | 69 ++----
fs/afs/dir.c | 99 +++-----
fs/autofs4/root.c | 4 +-
fs/bad_inode.c | 4 +-
fs/befs/linuxvfs.c | 40 ++--
fs/bfs/dir.c | 35 ++--
fs/btrfs/delayed-inode.c | 9 +-
fs/btrfs/delayed-inode.h | 3 +-
fs/btrfs/inode.c | 49 ++---
fs/ceph/dir.c | 99 ++++----
fs/cifs/cifsfs.c | 2 +-
fs/cifs/cifsfs.h | 2 +-
fs/cifs/readdir.c | 178 +++++++--------
fs/coda/dir.c | 66 ++----
fs/compat.c | 43 ++--
fs/compat_ioctl.c | 3 -
fs/configfs/dir.c | 122 ++++------
fs/cramfs/inode.c | 21 +-
fs/ecryptfs/file.c | 37 ++--
fs/efs/dir.c | 75 +++----
fs/exofs/dir.c | 38 ++--
fs/exportfs/expfs.c | 14 +-
fs/ext2/dir.c | 27 +--
fs/ext3/dir.c | 157 +++++--------
fs/ext4/dir.c | 158 ++++++-------
fs/ext4/ext4.h | 2 +-
fs/ext4/inline.c | 164 ++++++--------
fs/f2fs/dir.c | 36 ++--
fs/fat/dir.c | 104 +++++----
fs/freevxfs/vxfs_lookup.c | 55 ++---
fs/fuse/dir.c | 37 ++--
fs/gfs2/dir.c | 56 ++---
fs/gfs2/dir.h | 4 +-
fs/gfs2/export.c | 10 +-
fs/gfs2/file.c | 23 +--
fs/hfs/dir.c | 49 ++--
fs/hfsplus/dir.c | 50 ++---
fs/hostfs/hostfs_kern.c | 13 +-
fs/hpfs/dir.c | 56 +++---
fs/hppfs/hppfs.c | 33 ++--
fs/isofs/dir.c | 42 ++--
fs/jffs2/dir.c | 52 ++---
fs/jfs/jfs_dtree.c | 63 +++---
fs/jfs/jfs_dtree.h | 2 +-
fs/jfs/namei.c | 2 +-
fs/libfs.c | 80 +++----
fs/logfs/dir.c | 49 ++---
fs/minix/dir.c | 42 ++--
fs/ncpfs/dir.c | 78 +++----
fs/nfs/dir.c | 51 ++--
fs/nfsd/nfs4recover.c | 20 ++-
fs/nfsd/vfs.c | 9 +-
fs/nilfs2/dir.c | 48 ++---
fs/ntfs/dir.c | 84 +++-----
fs/ocfs2/dir.c | 151 ++++--------
fs/ocfs2/dir.h | 5 +-
fs/ocfs2/file.c | 4 +-
fs/ocfs2/journal.c | 14 +-
fs/omfs/dir.c | 94 +++-----
fs/openpromfs/inode.c | 95 ++++----
fs/proc/base.c | 363 +++++++++++------------------
fs/proc/fd.c | 96 ++++-----
fs/proc/generic.c | 102 +++-----
fs/proc/internal.h | 8 +-
fs/proc/namespaces.c | 76 ++-----
fs/proc/proc_net.c | 9 +-
fs/proc/proc_sysctl.c | 71 +++----
fs/proc/root.c | 19 +-
fs/qnx4/dir.c | 66 +++---
fs/qnx6/dir.c | 31 ++--
fs/readdir.c | 56 +++---
fs/reiserfs/dir.c | 36 ++--
fs/reiserfs/reiserfs.h | 2 +-
fs/reiserfs/xattr.c | 33 ++--
fs/romfs/super.c | 21 +-
fs/squashfs/dir.c | 40 +---
fs/sysfs/dir.c | 66 ++----
fs/sysv/dir.c | 37 ++--
fs/ubifs/dir.c | 69 +++---
fs/udf/dir.c | 63 ++---
fs/ufs/dir.c | 28 +--
fs/xfs/xfs_dir2.c | 13 +-
fs/xfs/xfs_dir2_block.c | 17 +-
fs/xfs/xfs_dir2_leaf.c | 18 +-
fs/xfs/xfs_dir2_priv.h | 11 +-
fs/xfs/xfs_dir2_sf.c | 31 +--
fs/xfs/xfs_file.c | 12 +-
fs/xfs/xfs_vnodeops.h | 3 +-
include/asm-generic/pgtable.h | 4 +
include/linux/fs.h | 47 ++++-
sound/soc/samsung/idma.c | 1 -
144 files changed, 1957 insertions(+), 2820 deletions(-)
rename {include/linux => drivers/block}/loop.h (98%)
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [git pull] vfs.git, part 1
2013-07-01 19:59 [git pull] vfs.git, part 1 Al Viro
@ 2013-08-01 9:00 ` Christoph Hellwig
0 siblings, 0 replies; 12+ messages in thread
From: Christoph Hellwig @ 2013-08-01 9:00 UTC (permalink / raw)
To: Al Viro; +Cc: Linus Torvalds, linux-kernel, linux-fsdevel
On Mon, Jul 01, 2013 at 08:59:49PM +0100, Al Viro wrote:
> The major change in that pile is ->readdir() replacement with ->iterate(),
> dealing with ->f_pos races in ->readdir() instances for good. There's
> a lot more, but I'd prefer to split the pull request into several stages
> and this is the first obvious cutoff point. Please, pull from the
> usual place -
> git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git for-linus
Again a little later, but iterate seems like a bad choice for a
directory specific operation in struct file operations, it really
should have "dir" somewhere in the method name.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [git pull] vfs.git part 1
2017-07-07 16:30 ` Linus Torvalds
@ 2017-07-07 22:55 ` Michael Ellerman
0 siblings, 0 replies; 12+ messages in thread
From: Michael Ellerman @ 2017-07-07 22:55 UTC (permalink / raw)
To: Linus Torvalds
Cc: Al Viro, Linux Kernel Mailing List, linux-fsdevel, linuxppc-dev
Linus Torvalds <torvalds@linux-foundation.org> writes:
> On Fri, Jul 7, 2017 at 8:59 AM, Linus Torvalds
> <torvalds@linux-foundation.org> wrote:
>>
>>> Patch coming.
>>
>> I'm not seeing a patch, so I did my own. But it's _entirely_ untested.
>> Does the attached fix things for you?
>
> Oh, I see you sent a patch to the list but didn't cc me like in this thread.
Oops, I sent it To you, but I forgot to make it a reply to this thread
which was daft.
cheers
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [git pull] vfs.git part 1
2017-07-07 17:35 ` Linus Torvalds
2017-07-07 18:59 ` Al Viro
@ 2017-07-07 22:50 ` Michael Ellerman
1 sibling, 0 replies; 12+ messages in thread
From: Michael Ellerman @ 2017-07-07 22:50 UTC (permalink / raw)
To: Linus Torvalds
Cc: Al Viro, Linux Kernel Mailing List, linux-fsdevel, linuxppc-dev
Linus Torvalds <torvalds@linux-foundation.org> writes:
> On Fri, Jul 7, 2017 at 8:59 AM, Linus Torvalds
> <torvalds@linux-foundation.org> wrote:
>>
>> The copy_flock_fields() macro has the arguments in order <from, to>,
>> but all the users seem to do it the other way around.
>
> Looking more at it, I think I'd also like copy_flock_fields() to take
> pointer arguments, to match all the code around it (both
> copy_to/from_user and the memset calls.
>
> The actual order of arguments I suspect Michael's patch did better -
> make the copy_flock_fields() just match the order of memcpy() and
> copy_to/from_user(), both of which have <dest,src> order.
>
> So I think my preferred patch would be something like this, even if it
> is bigger than either.
>
> Comments? Michael, does this work for your case?
Yeah that works, as committed in your tree. Sorry for the slow reply,
our time zones don't line up all that well :)
cheers
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [git pull] vfs.git part 1
2017-07-07 17:35 ` Linus Torvalds
@ 2017-07-07 18:59 ` Al Viro
2017-07-07 22:50 ` Michael Ellerman
1 sibling, 0 replies; 12+ messages in thread
From: Al Viro @ 2017-07-07 18:59 UTC (permalink / raw)
To: Linus Torvalds
Cc: Michael Ellerman, Linux Kernel Mailing List, linux-fsdevel, linuxppc-dev
On Fri, Jul 07, 2017 at 10:35:41AM -0700, Linus Torvalds wrote:
> Comments? Michael, does this work for your case?
Looks sane...
> +++ b/fs/fcntl.c
> @@ -520,50 +520,50 @@ SYSCALL_DEFINE3(fcntl64, unsigned int, fd, unsigned int, cmd,
>
> #ifdef CONFIG_COMPAT
> /* careful - don't use anywhere else */
> -#define copy_flock_fields(from, to) \
> - (to).l_type = (from).l_type; \
> - (to).l_whence = (from).l_whence; \
> - (to).l_start = (from).l_start; \
> - (to).l_len = (from).l_len; \
> - (to).l_pid = (from).l_pid;
> -
> -static int get_compat_flock(struct flock *kfl, struct compat_flock __user *ufl)
> +#define copy_flock_fields(dst, src) \
> + (dst)->l_type = (src)->l_type; \
> + (dst)->l_whence = (src)->l_whence; \
> + (dst)->l_start = (src)->l_start; \
> + (dst)->l_len = (src)->l_len; \
> + (dst)->l_pid = (src)->l_pid;
> +
> +static int get_compat_flock(struct flock *kfl, const struct compat_flock __user *ufl)
> {
> struct compat_flock fl;
>
> if (copy_from_user(&fl, ufl, sizeof(struct compat_flock)))
> return -EFAULT;
> - copy_flock_fields(*kfl, fl);
> + copy_flock_fields(kfl, &fl);
> return 0;
> }
>
> -static int get_compat_flock64(struct flock *kfl, struct compat_flock64 __user *ufl)
> +static int get_compat_flock64(struct flock *kfl, const struct compat_flock64 __user *ufl)
> {
> struct compat_flock64 fl;
>
> if (copy_from_user(&fl, ufl, sizeof(struct compat_flock64)))
> return -EFAULT;
> - copy_flock_fields(*kfl, fl);
> + copy_flock_fields(kfl, &fl);
> return 0;
> }
>
> -static int put_compat_flock(struct flock *kfl, struct compat_flock __user *ufl)
> +static int put_compat_flock(const struct flock *kfl, struct compat_flock __user *ufl)
> {
> struct compat_flock fl;
>
> memset(&fl, 0, sizeof(struct compat_flock));
> - copy_flock_fields(fl, *kfl);
> + copy_flock_fields(&fl, kfl);
> if (copy_to_user(ufl, &fl, sizeof(struct compat_flock)))
> return -EFAULT;
> return 0;
> }
>
> -static int put_compat_flock64(struct flock *kfl, struct compat_flock64 __user *ufl)
> +static int put_compat_flock64(const struct flock *kfl, struct compat_flock64 __user *ufl)
> {
> struct compat_flock64 fl;
>
> memset(&fl, 0, sizeof(struct compat_flock64));
> - copy_flock_fields(fl, *kfl);
> + copy_flock_fields(&fl, kfl);
> if (copy_to_user(ufl, &fl, sizeof(struct compat_flock64)))
> return -EFAULT;
> return 0;
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [git pull] vfs.git part 1
2017-07-07 15:59 ` Linus Torvalds
2017-07-07 16:30 ` Linus Torvalds
@ 2017-07-07 17:35 ` Linus Torvalds
2017-07-07 18:59 ` Al Viro
2017-07-07 22:50 ` Michael Ellerman
1 sibling, 2 replies; 12+ messages in thread
From: Linus Torvalds @ 2017-07-07 17:35 UTC (permalink / raw)
To: Michael Ellerman
Cc: Al Viro, Linux Kernel Mailing List, linux-fsdevel, linuxppc-dev
[-- Attachment #1: Type: text/plain, Size: 743 bytes --]
On Fri, Jul 7, 2017 at 8:59 AM, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
>
> The copy_flock_fields() macro has the arguments in order <from, to>,
> but all the users seem to do it the other way around.
Looking more at it, I think I'd also like copy_flock_fields() to take
pointer arguments, to match all the code around it (both
copy_to/from_user and the memset calls.
The actual order of arguments I suspect Michael's patch did better -
make the copy_flock_fields() just match the order of memcpy() and
copy_to/from_user(), both of which have <dest,src> order.
So I think my preferred patch would be something like this, even if it
is bigger than either.
Comments? Michael, does this work for your case?
Linus
[-- Attachment #2: patch.diff --]
[-- Type: text/plain, Size: 2332 bytes --]
fs/fcntl.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/fs/fcntl.c b/fs/fcntl.c
index b6bd89628025..3b01b646e528 100644
--- a/fs/fcntl.c
+++ b/fs/fcntl.c
@@ -520,50 +520,50 @@ SYSCALL_DEFINE3(fcntl64, unsigned int, fd, unsigned int, cmd,
#ifdef CONFIG_COMPAT
/* careful - don't use anywhere else */
-#define copy_flock_fields(from, to) \
- (to).l_type = (from).l_type; \
- (to).l_whence = (from).l_whence; \
- (to).l_start = (from).l_start; \
- (to).l_len = (from).l_len; \
- (to).l_pid = (from).l_pid;
-
-static int get_compat_flock(struct flock *kfl, struct compat_flock __user *ufl)
+#define copy_flock_fields(dst, src) \
+ (dst)->l_type = (src)->l_type; \
+ (dst)->l_whence = (src)->l_whence; \
+ (dst)->l_start = (src)->l_start; \
+ (dst)->l_len = (src)->l_len; \
+ (dst)->l_pid = (src)->l_pid;
+
+static int get_compat_flock(struct flock *kfl, const struct compat_flock __user *ufl)
{
struct compat_flock fl;
if (copy_from_user(&fl, ufl, sizeof(struct compat_flock)))
return -EFAULT;
- copy_flock_fields(*kfl, fl);
+ copy_flock_fields(kfl, &fl);
return 0;
}
-static int get_compat_flock64(struct flock *kfl, struct compat_flock64 __user *ufl)
+static int get_compat_flock64(struct flock *kfl, const struct compat_flock64 __user *ufl)
{
struct compat_flock64 fl;
if (copy_from_user(&fl, ufl, sizeof(struct compat_flock64)))
return -EFAULT;
- copy_flock_fields(*kfl, fl);
+ copy_flock_fields(kfl, &fl);
return 0;
}
-static int put_compat_flock(struct flock *kfl, struct compat_flock __user *ufl)
+static int put_compat_flock(const struct flock *kfl, struct compat_flock __user *ufl)
{
struct compat_flock fl;
memset(&fl, 0, sizeof(struct compat_flock));
- copy_flock_fields(fl, *kfl);
+ copy_flock_fields(&fl, kfl);
if (copy_to_user(ufl, &fl, sizeof(struct compat_flock)))
return -EFAULT;
return 0;
}
-static int put_compat_flock64(struct flock *kfl, struct compat_flock64 __user *ufl)
+static int put_compat_flock64(const struct flock *kfl, struct compat_flock64 __user *ufl)
{
struct compat_flock64 fl;
memset(&fl, 0, sizeof(struct compat_flock64));
- copy_flock_fields(fl, *kfl);
+ copy_flock_fields(&fl, kfl);
if (copy_to_user(ufl, &fl, sizeof(struct compat_flock64)))
return -EFAULT;
return 0;
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [git pull] vfs.git part 1
2017-07-07 15:59 ` Linus Torvalds
@ 2017-07-07 16:30 ` Linus Torvalds
2017-07-07 22:55 ` Michael Ellerman
2017-07-07 17:35 ` Linus Torvalds
1 sibling, 1 reply; 12+ messages in thread
From: Linus Torvalds @ 2017-07-07 16:30 UTC (permalink / raw)
To: Michael Ellerman
Cc: Al Viro, Linux Kernel Mailing List, linux-fsdevel, linuxppc-dev
On Fri, Jul 7, 2017 at 8:59 AM, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
>
>> Patch coming.
>
> I'm not seeing a patch, so I did my own. But it's _entirely_ untested.
> Does the attached fix things for you?
Oh, I see you sent a patch to the list but didn't cc me like in this thread.
Hmm. Al - I'd like to add the "const" parts at least. How the ordering
gets fixed (I changed it in the users of the macro, Michael changed
the macro itself) I don't much care about.
Can you get me a pull request soon since this presumably also breaks
every other compat case, and it just happened that power was the one
that noticed it first.. Or I can just commit my version, but I guess
Michael's is at least tested..
Linus
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [git pull] vfs.git part 1
2017-07-07 12:46 ` Michael Ellerman
@ 2017-07-07 15:59 ` Linus Torvalds
2017-07-07 16:30 ` Linus Torvalds
2017-07-07 17:35 ` Linus Torvalds
0 siblings, 2 replies; 12+ messages in thread
From: Linus Torvalds @ 2017-07-07 15:59 UTC (permalink / raw)
To: Michael Ellerman
Cc: Al Viro, Linux Kernel Mailing List, linux-fsdevel, linuxppc-dev
[-- Attachment #1: Type: text/plain, Size: 842 bytes --]
On Fri, Jul 7, 2017 at 5:46 AM, Michael Ellerman <mpe@ellerman.id.au> wrote:
> Al Viro <viro@ZenIV.linux.org.uk> writes:
>
>>
>> Switch flock copyin/copyout primitives to copy_{from,to}_user() (2017-06-26 23:52:44 -0400)
>
> This commit seems to have broken networking on a bunch of my PPC
> machines (64-bit kernel, 32-bit userspace).
Bah. I think that commit is entirely broken, due to having the
arguments to the "copy_flock_fields()" in the wrong order.
The copy_flock_fields() macro has the arguments in order <from, to>,
but all the users seem to do it the other way around.
I think it would have been more obvious if the put_compat_flock*()
source argument had been "const".
> Patch coming.
I'm not seeing a patch, so I did my own. But it's _entirely_ untested.
Does the attached fix things for you?
Linus
[-- Attachment #2: patch.diff --]
[-- Type: text/plain, Size: 1885 bytes --]
fs/fcntl.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/fs/fcntl.c b/fs/fcntl.c
index b6bd89628025..eeb19e22fd08 100644
--- a/fs/fcntl.c
+++ b/fs/fcntl.c
@@ -527,43 +527,43 @@ SYSCALL_DEFINE3(fcntl64, unsigned int, fd, unsigned int, cmd,
(to).l_len = (from).l_len; \
(to).l_pid = (from).l_pid;
-static int get_compat_flock(struct flock *kfl, struct compat_flock __user *ufl)
+static int get_compat_flock(struct flock *kfl, const struct compat_flock __user *ufl)
{
struct compat_flock fl;
if (copy_from_user(&fl, ufl, sizeof(struct compat_flock)))
return -EFAULT;
- copy_flock_fields(*kfl, fl);
+ copy_flock_fields(fl, *kfl);
return 0;
}
-static int get_compat_flock64(struct flock *kfl, struct compat_flock64 __user *ufl)
+static int get_compat_flock64(struct flock *kfl, const struct compat_flock64 __user *ufl)
{
struct compat_flock64 fl;
if (copy_from_user(&fl, ufl, sizeof(struct compat_flock64)))
return -EFAULT;
- copy_flock_fields(*kfl, fl);
+ copy_flock_fields(fl, *kfl);
return 0;
}
-static int put_compat_flock(struct flock *kfl, struct compat_flock __user *ufl)
+static int put_compat_flock(const struct flock *kfl, struct compat_flock __user *ufl)
{
struct compat_flock fl;
memset(&fl, 0, sizeof(struct compat_flock));
- copy_flock_fields(fl, *kfl);
+ copy_flock_fields(*kfl, fl);
if (copy_to_user(ufl, &fl, sizeof(struct compat_flock)))
return -EFAULT;
return 0;
}
-static int put_compat_flock64(struct flock *kfl, struct compat_flock64 __user *ufl)
+static int put_compat_flock64(const struct flock *kfl, struct compat_flock64 __user *ufl)
{
struct compat_flock64 fl;
memset(&fl, 0, sizeof(struct compat_flock64));
- copy_flock_fields(fl, *kfl);
+ copy_flock_fields(*kfl, fl);
if (copy_to_user(ufl, &fl, sizeof(struct compat_flock64)))
return -EFAULT;
return 0;
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [git pull] vfs.git part 1
2017-07-05 7:14 Al Viro
@ 2017-07-07 12:46 ` Michael Ellerman
2017-07-07 15:59 ` Linus Torvalds
0 siblings, 1 reply; 12+ messages in thread
From: Michael Ellerman @ 2017-07-07 12:46 UTC (permalink / raw)
To: Al Viro, Linus Torvalds; +Cc: linux-fsdevel, linuxppc-dev, linux-kernel
Al Viro <viro@ZenIV.linux.org.uk> writes:
> vfs.git topology is rather convoluted this cycle, so
> I'm afraid that it'll take more pull requests than usual ;-/
>
> The first pile is #work.misc-set_fs. Assorted getting rid
> of cargo-culted access_ok(), cargo-culted set_fs() and
> field-by-field copyouts. The same description applies to
> a lot of stuff in other branches - this is just the stuff that
> didn't fit into a more specific topical branch.
>
> The following changes since commit c86daad2c25bfd4a33d48b7691afaa96d9c5ab46:
>
> Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input (2017-05-26 16:45:13 -0700)
>
> are available in the git repository at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git work.misc-set_fs
>
> for you to fetch changes up to 8c6657cb50cb037ff58b3f6a547c6569568f3527:
>
> Switch flock copyin/copyout primitives to copy_{from,to}_user() (2017-06-26 23:52:44 -0400)
This commit seems to have broken networking on a bunch of my PPC
machines (64-bit kernel, 32-bit userspace).
# first bad commit: [8c6657cb50cb037ff58b3f6a547c6569568f3527] Switch flock copyin/copyout primitives to copy_{from,to}_user()
The symptom is eth0 doesn't get address via dhcp.
Reverting it on top of master (9f45efb928) everything works OK again.
Trying to bring networking up manually gives:
# ifup eth0
ifup: failed to lock lockfile /run/network/ifstate.eth0: Invalid argument
strace shows:
5647 fcntl64(3, F_SETLK, {l_type=F_WRLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = -1 EINVAL (Invalid argument)
5647 write(2, "ifup: failed to lock lockfile /r"..., 74) = 74
vs the working case:
6005 fcntl64(3, F_SETLK, {l_type=F_WRLCK, l_whence=SEEK_SET, l_start=0, l_len=0}) = 0
Patch coming.
cheers
^ permalink raw reply [flat|nested] 12+ messages in thread
* [git pull] vfs.git part 1
@ 2017-07-05 7:14 Al Viro
2017-07-07 12:46 ` Michael Ellerman
0 siblings, 1 reply; 12+ messages in thread
From: Al Viro @ 2017-07-05 7:14 UTC (permalink / raw)
To: Linus Torvalds; +Cc: linux-kernel, linux-fsdevel
vfs.git topology is rather convoluted this cycle, so
I'm afraid that it'll take more pull requests than usual ;-/
The first pile is #work.misc-set_fs. Assorted getting rid
of cargo-culted access_ok(), cargo-culted set_fs() and
field-by-field copyouts. The same description applies to
a lot of stuff in other branches - this is just the stuff that
didn't fit into a more specific topical branch.
The following changes since commit c86daad2c25bfd4a33d48b7691afaa96d9c5ab46:
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input (2017-05-26 16:45:13 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git work.misc-set_fs
for you to fetch changes up to 8c6657cb50cb037ff58b3f6a547c6569568f3527:
Switch flock copyin/copyout primitives to copy_{from,to}_user() (2017-06-26 23:52:44 -0400)
----------------------------------------------------------------
Al Viro (8):
drbd: ->sendpage() never needed set_fs()
nfsd_readlink(): switch to vfs_get_link()
compat statfs: switch to copy_to_user()
isdn: get rid of pointless access_ok()
adb: get rid of pointless access_ok()
lpfc debugfs: get rid of pointless access_ok()
Merge remote-tracking branch 'jl/locks-4.13' into work.misc-set_fs
Switch flock copyin/copyout primitives to copy_{from,to}_user()
Christoph Hellwig (2):
fs/locks: pass kernel struct flock to fcntl_getlk/setlk
fs/locks: don't mess with the address limit in compat_fcntl64
Jeff Layton (1):
fs/fcntl: return -ESRCH in f_setown when pid/pgid can't be found
Jiri Slaby (2):
fs/fcntl: f_setown, allow returning error
fs/fcntl: f_setown, avoid undefined behaviour
Mauro Carvalho Chehab (1):
fs: locks: Fix some troubles at kernel-doc comments
drivers/block/drbd/drbd_main.c | 3 -
drivers/isdn/i4l/isdn_common.c | 18 ---
drivers/isdn/i4l/isdn_ppp.c | 6 -
drivers/isdn/isdnloop/isdnloop.c | 2 -
drivers/macintosh/adb.c | 4 -
drivers/scsi/lpfc/lpfc_debugfs.c | 20 ----
fs/fcntl.c | 231 +++++++++++++++++++++++----------------
fs/locks.c | 97 +++++-----------
fs/nfsd/vfs.c | 39 +++----
fs/statfs.c | 58 +++++-----
include/linux/fs.h | 10 +-
net/socket.c | 3 +-
12 files changed, 220 insertions(+), 271 deletions(-)
^ permalink raw reply [flat|nested] 12+ messages in thread
* [git pull] vfs.git part 1
@ 2016-07-28 15:55 Al Viro
0 siblings, 0 replies; 12+ messages in thread
From: Al Viro @ 2016-07-28 15:55 UTC (permalink / raw)
To: Linus Torvalds; +Cc: linux-kernel, linux-fsdevel
Assorted cleanups and fixes. Probably the most interesting part long-term
is ->d_init() - that will have a bunch of followups in (at least) ceph
and lustre, but we'll need to sort the barrier-related rules before it
can get used for really non-trivial stuff. Another fun thing is the merge
of ->d_iput() callers (dentry_iput() and dentry_unlink_inode()) and
a bunch of ->d_compare() ones (all except the one in __d_lookup_lru()).
The only conflict is in fs/nfs/dir.c; I can push a merge candidate, but
the conflict is really trivial...
The following changes since commit e06b933e6ded42384164d28a2060b7f89243b895:
namespace: update event counter when umounting a deleted dentry (2016-06-30 23:28:30 -0400)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git work.misc
for you to fetch changes up to 47be61845c775643f1aa4d2a54343549f943c94c:
fs/dcache.c: avoid soft-lockup in dput() (2016-07-24 16:37:16 -0400)
----------------------------------------------------------------
Al Viro (21):
undo "fs: allow d_instantiate to be called with negative parent dentry"
drbd: ->d_parent is never NULL or negative
securityfs: ->d_parent is never NULL or negative
tracefs: ->d_parent is never NULL or negative...
orangefs: don't open-code %pd2
nfs_lookup(): remove debris left over from old sillyunlink exclusion
debugfs: ->d_parent is never NULL or negative
9p: new helper - v9fs_parent_fid()
trim fsnotify hooks a bit
file_inode(f)->i_mapping is f->f_mapping
missed comment updates from ->direct_IO() prototype change
orangefs: constify inode_operations
ufs: get rid of redundant checks
drop redundant ->owner initializations
binfmt_misc: ->s_root is not going anywhere
unify dentry_iput() and dentry_unlink_inode()
Merge branch 'for-linus' into work.misc
new helper: d_same_name()
Merge branch 'd_real' of git://git.kernel.org/.../mszeredi/vfs into work.misc
bdev: get rid of ->bd_inodes
Merge branch 'test.d_iput' into work.misc
He Kuang (1):
dentry_cmp(): use lockless_dereference() instead of smp_read_barrier_depends()
Matthew Wilcox (1):
Remove last traces of ->sync_page
Miklos Szeredi (4):
vfs: merge .d_select_inode() into .d_real()
vfs: document ->d_real()
vfs: clean up documentation
vfs: new d_init method
Oleg Drokin (1):
vfs: Update lookup_dcache() comment
Wei Fang (1):
fs/dcache.c: avoid soft-lockup in dput()
Documentation/block/biodoc.txt | 3 +-
Documentation/filesystems/Locking | 18 ++-
Documentation/filesystems/vfs.txt | 51 +++++----
drivers/block/drbd/drbd_debugfs.c | 4 -
drivers/gpu/drm/armada/armada_gem.c | 4 +-
drivers/gpu/drm/drm_gem.c | 2 +-
drivers/gpu/drm/etnaviv/etnaviv_gem.c | 2 +-
drivers/gpu/drm/i915/i915_gem.c | 10 +-
drivers/gpu/drm/omapdrm/omap_gem.c | 2 +-
drivers/gpu/drm/ttm/ttm_tt.c | 4 +-
fs/9p/fid.h | 4 +
fs/9p/vfs_addr.c | 1 -
fs/9p/vfs_inode.c | 10 +-
fs/9p/vfs_inode_dotl.c | 16 +--
fs/binfmt_misc.c | 12 +-
fs/block_dev.c | 16 +--
fs/cachefiles/proc.c | 1 -
fs/cifs/cifs_debug.c | 7 --
fs/coda/pioctl.c | 1 -
fs/dcache.c | 208 +++++++++++-----------------------
fs/debugfs/inode.c | 7 --
fs/ext4/mballoc.c | 1 -
fs/ext4/sysfs.c | 1 -
fs/f2fs/super.c | 1 -
fs/fscache/histogram.c | 1 -
fs/fscache/object-list.c | 1 -
fs/fscache/stats.c | 1 -
fs/hfs/inode.c | 2 +-
fs/hfsplus/inode.c | 2 +-
fs/isofs/compress.c | 1 -
fs/jfs/jfs_debug.c | 1 -
fs/jfs/jfs_logmgr.c | 1 -
fs/jfs/jfs_metapage.c | 1 -
fs/jfs/jfs_txnmgr.c | 2 -
fs/jfs/jfs_xtree.c | 1 -
fs/lockd/procfs.c | 1 -
fs/namei.c | 7 +-
fs/nfs/client.c | 2 -
fs/nfs/dir.c | 11 +-
fs/nfs/direct.c | 4 +-
fs/nfsd/nfsctl.c | 3 -
fs/nfsd/stats.c | 1 -
fs/ntfs/inode.c | 2 +-
fs/ocfs2/aops.c | 2 +-
fs/open.c | 8 +-
fs/orangefs/inode.c | 2 +-
fs/orangefs/namei.c | 10 +-
fs/orangefs/orangefs-kernel.h | 6 +-
fs/orangefs/symlink.c | 2 +-
fs/overlayfs/inode.c | 31 ++---
fs/overlayfs/overlayfs.h | 2 +-
fs/overlayfs/super.c | 20 +++-
fs/tracefs/inode.c | 7 --
fs/ufs/dir.c | 17 +--
fs/xfs/xfs_stats.c | 1 -
include/linux/dcache.h | 41 +++----
include/linux/fs.h | 8 +-
include/linux/fsnotify.h | 12 --
include/linux/fsnotify_backend.h | 20 +---
mm/hugetlb.c | 2 +-
security/inode.c | 15 +--
61 files changed, 224 insertions(+), 413 deletions(-)
^ permalink raw reply [flat|nested] 12+ messages in thread
* [git pull] vfs.git part 1
@ 2015-02-17 17:15 Al Viro
0 siblings, 0 replies; 12+ messages in thread
From: Al Viro @ 2015-02-17 17:15 UTC (permalink / raw)
To: Linus Torvalds; +Cc: linux-kernel, linux-fsdevel
This cycle a lot of stuff sits on topical branches, so I'll be
sending more or a less pull request per branch. If you prefer a single
pull request in such situations for the future, please tell. This is
the first pile; more to follow in a few. In this one are several misc
commits from early in the cycle (before I went for separate branches) +
rework of mntput/dput ordering on umount, switching to use of fs_pin
instead of convoluted games in namespace_unlock(). Please, pull from
git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git for-linus
Shortlog:
Al Viro (14):
selinuxfs: don't open-code d_genocide()
ncpfs: get rid of d_validate() nonsense
kill d_validate()
gut proc_register() a bit
get rid of lustre_dump_dentry()
file->f_path.dentry is pinned down for as long as the file is open...
mode_t whack-a-mole: chelsio
kill pin_put()
pull bumping refcount into ->kill()
take count and rcu_head out of fs_pin
get rid of the second argument of acct_kill()
allow attaching fs_pin to a group not associated with some superblock
new fs_pin killing logics
switch the IO-triggering parts of umount to fs_pin
Linus Torvalds (1):
dcache: let the dentry count go down to zero without taking d_lock
Diffstat:
drivers/net/ethernet/chelsio/cxgb4/cxgb4_debugfs.h | 2 +-
drivers/staging/lustre/lustre/llite/dcache.c | 8 --
.../staging/lustre/lustre/llite/llite_internal.h | 1 -
drivers/staging/lustre/lustre/llite/llite_lib.c | 42 ------
fs/dcache.c | 149 ++++++++++++++++-----
fs/fs_pin.c | 96 ++++++++-----
fs/internal.h | 2 +-
fs/mount.h | 4 +-
fs/namespace.c | 44 +++---
fs/ncpfs/dir.c | 98 +++++++-------
fs/ncpfs/ncp_fs_i.h | 1 +
fs/ncpfs/ncplib_kernel.h | 30 -----
fs/proc/generic.c | 25 ++--
fs/super.c | 4 +-
include/linux/dcache.h | 3 -
include/linux/fs_pin.h | 25 ++--
include/linux/lockref.h | 3 +-
include/linux/pid_namespace.h | 4 +-
kernel/acct.c | 94 +++++++------
kernel/auditsc.c | 5 +-
lib/lockref.c | 36 +++--
security/commoncap.c | 6 +-
security/selinux/selinuxfs.c | 52 +------
23 files changed, 356 insertions(+), 378 deletions(-)
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2017-07-07 22:55 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-01 19:59 [git pull] vfs.git, part 1 Al Viro
2013-08-01 9:00 ` Christoph Hellwig
2015-02-17 17:15 [git pull] vfs.git " Al Viro
2016-07-28 15:55 Al Viro
2017-07-05 7:14 Al Viro
2017-07-07 12:46 ` Michael Ellerman
2017-07-07 15:59 ` Linus Torvalds
2017-07-07 16:30 ` Linus Torvalds
2017-07-07 22:55 ` Michael Ellerman
2017-07-07 17:35 ` Linus Torvalds
2017-07-07 18:59 ` Al Viro
2017-07-07 22:50 ` Michael Ellerman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).