lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <cover.1426502566.git.osandov@osandov.com>
Date:	Mon, 16 Mar 2015 04:33:48 -0700
From:	Omar Sandoval <osandov@...ndov.com>
To:	Alexander Viro <viro@...iv.linux.org.uk>,
	linux-fsdevel@...r.kernel.org, linux-btrfs@...r.kernel.org,
	ceph-devel@...r.kernel.org, linux-cifs@...r.kernel.org,
	osd-dev@...n-osd.org, linux-ext4@...r.kernel.org,
	linux-f2fs-devel@...ts.sourceforge.net,
	fuse-devel@...ts.sourceforge.net, cluster-devel@...hat.com,
	jfs-discussion@...ts.sourceforge.net, HPDD-discuss@...ts.01.org,
	linux-nfs@...r.kernel.org, linux-nilfs@...r.kernel.org,
	ocfs2-devel@....oracle.com, reiserfs-devel@...r.kernel.org,
	v9fs-developer@...ts.sourceforge.net, xfs@....sgi.com
Cc:	linux-kernel@...r.kernel.org, Chris Mason <clm@...com>,
	Josef Bacik <jbacik@...com>, David Sterba <dsterba@...e.cz>,
	"Yan Zheng" <zyan@...hat.com>, Sage Weil <sage@...hat.com>,
	Steve French <sfrench@...ba.org>,
	Boaz Harrosh <ooo@...ctrozaur.com>,
	Benny Halevy <bhalevy@...marydata.com>,
	Jan Kara <jack@...e.cz>, "Theodore Ts'o" <tytso@....edu>,
	Andreas Dilger <adilger.kernel@...ger.ca>,
	Jaegeuk Kim <jaegeuk@...nel.org>,
	Changman Lee <cm224.lee@...sung.com>,
	Miklos Szeredi <miklos@...redi.hu>,
	Steven Whitehouse <swhiteho@...hat.com>,
	Dave Kleikamp <shaggy@...nel.org>,
	Oleg Drokin <oleg.drokin@...el.com>,
	Trond Myklebust <trond.myklebust@...marydata.com>,
	Anna Schumaker <anna.schumaker@...app.com>,
	Ryusuke Konishi <konishi.ryusuke@....ntt.co.jp>,
	Mark Fasheh <mfasheh@...e.com>,
	Joel Becker <jlbec@...lplan.org>,
	Eric Van Hensbergen <ericvh@...il.com>,
	Ron Minnich <rminnich@...dia.gov>,
	Latchesar Ionkov <lucho@...kov.net>,
	Dave Chinner <david@...morbit.com>,
	Omar Sandoval <osandov@...ndov.com>
Subject: [RFC PATCH 0/5] Remove rw parameter from direct_IO()

Hi,

Al, here's some cleanup that you mentioned back in December that I got
around to (https://lkml.org/lkml/2014/12/15/28).

In summary, the rw parameter to a_ops->direct_IO() is redundant with
.type in struct iov_iter. Additionally, rw is inconsistently checked for
being a WRITE; some filesystems do rw == WRITE, others do rw & WRITE,
and others do both within the same function :) The distinction is that
swapout may OR in the ITER_BVEC flag in the rw passed to ->direct_IO(),
so the two are not equivalent (although this really only happens for
swap-over-NFS, but it's scary nonetheless). After looking through all of
these, it definitely looks like every check means for ANY write, not
just non-kernel writes.

So, the solution presented here is:

- Add a helper, iov_iter_rw(), which always returns either READ or
  WRITE, no ITER_.* or REQ_.* nonsense mixed in. For consistency, the
  return value is always checked for equality
- Get rid of all uses of rw in any implementations of direct_IO,
  starting with the generic code
- Nuke the actual parameter and update the documentation

I decided to squish all of the filesystems together in patch 4 to avoid
inundating the mailing lists with 20+ mostly two-line patches, but I can
split those out if that's any better. Additionally, patch 1 pulls fs.h
into uio.h, which seems undesirable.

These were mostly just compile tested, with a couple of direct I/O
xfstests run on btrfs as quick sanity check, so getting some more eyes
on is probably a good thing. They should apply on top of v4.0-rc4.
Please comment away.

Thank you,

Omar Sandoval (5):
  new helper: iov_iter_rw()
  Remove rw from {,__,do_}blockdev_direct_IO()
  Remove rw from dax_{do_,}io()
  direct_IO: use iov_iter_rw() instead of rw everywhere
  direct_IO: remove rw from a_ops->direct_IO()

 Documentation/filesystems/Locking          |  2 +-
 Documentation/filesystems/vfs.txt          |  2 +-
 drivers/staging/lustre/lustre/llite/rw26.c | 22 ++++++++---------
 fs/9p/vfs_addr.c                           |  2 +-
 fs/affs/file.c                             |  9 +++----
 fs/block_dev.c                             |  8 +++---
 fs/btrfs/inode.c                           | 24 +++++++++---------
 fs/ceph/addr.c                             |  3 +--
 fs/cifs/file.c                             |  3 +--
 fs/dax.c                                   | 27 ++++++++++-----------
 fs/direct-io.c                             | 39 ++++++++++++++----------------
 fs/exofs/inode.c                           |  4 +--
 fs/ext2/inode.c                            | 11 ++++-----
 fs/ext3/inode.c                            | 14 +++++------
 fs/ext4/ext4.h                             |  4 +--
 fs/ext4/indirect.c                         | 25 ++++++++++---------
 fs/ext4/inode.c                            | 28 ++++++++++-----------
 fs/f2fs/data.c                             | 22 ++++++++---------
 fs/fat/inode.c                             |  9 +++----
 fs/fuse/file.c                             | 16 ++++++------
 fs/gfs2/aops.c                             | 16 ++++++------
 fs/hfs/inode.c                             |  8 +++---
 fs/hfsplus/inode.c                         |  9 +++----
 fs/jfs/inode.c                             |  8 +++---
 fs/nfs/direct.c                            |  4 +--
 fs/nilfs2/inode.c                          | 10 +++-----
 fs/ocfs2/aops.c                            | 22 +++++++----------
 fs/reiserfs/inode.c                        |  8 +++---
 fs/udf/file.c                              |  3 +--
 fs/udf/inode.c                             |  7 +++---
 fs/xfs/xfs_aops.c                          | 12 ++++-----
 include/linux/fs.h                         | 24 +++++++++---------
 include/linux/nfs_fs.h                     |  2 +-
 include/linux/uio.h                        | 10 ++++++++
 mm/filemap.c                               |  4 +--
 mm/page_io.c                               |  4 +--
 36 files changed, 206 insertions(+), 219 deletions(-)

-- 
2.3.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ