orangefs: a fix and two cleanups and a merge conflict

Fix: Christoph Hellwig noticed that some logic I added to
      orangefs_file_read_iter introduced a race condition, so he
      sent a reversion patch. I had to modify his patch since
      reverting at this point broke Orangefs.
 
 Cleanup 1: Christoph Hellwig noticed that we were doing some unnecessary
            work in orangefs_flush, so he sent in a patch that removed
            the un-needed code.
 
 Cleanup 2: Al Viro told me he had trouble building Orangefs. Orangefs
            should be easy to build, even for Al :-). I looked back
            at the test server build notes in orangefs.txt, just in case
            that's where the trouble really is, and found a couple of
            typos and made a couple of clarifications.
 
 Merge Conflict: Stephen Rothwell reported that my modifications to
                 orangefs.txt caused a merge conflict with orangefs.rst
                 in Linux Next. I wasn't sure what to do, so I asked,
                 and Jonathan Corbet said not to worry about it and
                 just to report it to Linus.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEIGSFVdO6eop9nER2z0QOqevODb4FAl6Qft8ACgkQz0QOqevO
 Db6v1A/7BnEalIB30OPy2PUAcobY3Bqtio2Mb7ULquvZAarVvNgTZIyI4UGt0VBN
 bc8KOpKF/ZJIJLjgyorjnA7KGYg+FLdWatTu5GkdEz6DxKbbvXsokJI/uZkXVIGF
 BS/Ic0KmOBL+wUjqc/xfJQrm5dSLp2woHWfhyWoKuKJtC0Ut9a0ov0Y8T2X/F4Jw
 xV4rMhuEy9zBU6nLHOHEumt9RDUAL2TlK4RJ9on0OmV1W/iizin6GU2q20E6fJVb
 C0ShqigQEI+Uo6QXKf9w8eqWH4Vq431L0zlwASR63DgnmMXM4osx3iVETTcOoeg7
 xcz7mjMOqutAu1R89Y0BIBglVvZaP+Auds+awFRvcGFoM5s19DlolRYofLqiIdzy
 OsQd2oT2DBEHBkYnGCRXnqPLj+Q9/sMs4vNAaHUcEz1pn3x57lgxFFPHQEF6+bLy
 WX/cEVRgqjHhieLUCXLI9jVA54mhvsGZuyXputLOA7r3Dqjk5LIWPIGIW1ksjA1T
 Kl7Ge/C4i3OOAJDtjcr+kl5LoKu/ppPmg+fOaTQ9qmGWRiwXdfoR4GMT3pEF0Uam
 bXwR2CZlsUBIlqO9FmWwrdDddt55gMRbjNcqzgqpCyDKQ5zFM+nWgsl5oHFYkTty
 QYMZtslM8icZPxGYucrhqLxaqRJ4kJoCcoxmOyPrfN/0cDWuIDc=
 =dNWv
 -----END PGP SIGNATURE-----

Merge tag 'for-linus-5.7-ofs1' of git://git.kernel.org/pub/scm/linux/kernel/git/hubcap/linux

Pull orangefs updates from Mike Marshall:
 "A fix and two cleanups.

  Fix:

   - Christoph Hellwig noticed that some logic I added to
     orangefs_file_read_iter introduced a race condition, so he sent a
     reversion patch. I had to modify his patch since reverting at this
     point broke Orangefs.

  Cleanups:

   - Christoph Hellwig noticed that we were doing some unnecessary work
     in orangefs_flush, so he sent in a patch that removed the un-needed
     code.

   - Al Viro told me he had trouble building Orangefs. Orangefs should
     be easy to build, even for Al :-).

     I looked back at the test server build notes in orangefs.txt, just
     in case that's where the trouble really is, and found a couple of
     typos and made a couple of clarifications"

* tag 'for-linus-5.7-ofs1' of git://git.kernel.org/pub/scm/linux/kernel/git/hubcap/linux:
  orangefs: clarify build steps for test server in orangefs.txt
  orangefs: don't mess with I_DIRTY_TIMES in orangefs_flush
  orangefs: get rid of knob code...
This commit is contained in:
Linus Torvalds 2020-04-10 17:50:01 -07:00
commit 4e4bdcfa21
4 changed files with 26 additions and 85 deletions

View File

@ -41,16 +41,6 @@ Documentation
http://www.orangefs.org/documentation/
Userspace Filesystem Source
===========================
http://www.orangefs.org/download
Orangefs versions prior to 2.9.3 would not be compatible with the
upstream version of the kernel client.
Running ORANGEFS On a Single Server
===================================
@ -94,6 +84,14 @@ Mount the filesystem::
mount -t pvfs2 tcp://localhost:3334/orangefs /pvfsmnt
Userspace Filesystem Source
===========================
http://www.orangefs.org/download
Orangefs versions prior to 2.9.3 would not be compatible with the
upstream version of the kernel client.
Building ORANGEFS on a Single Server
====================================
@ -107,18 +105,24 @@ default, we will probably be changing the default to LMDB soon.
::
./configure --prefix=/opt/ofs --with-db-backend=lmdb
./configure --prefix=/opt/ofs --with-db-backend=lmdb --disable-usrint
make
make install
Create an orangefs config file::
Create an orangefs config file by running pvfs2-genconfig and
specifying a target config file. Pvfs2-genconfig will prompt you
through. Generally it works fine to take the defaults, but you
should use your server's hostname, rather than "localhost" when
it comes to that question::
/opt/ofs/bin/pvfs2-genconfig /etc/pvfs2.conf
Create an /etc/pvfs2tab file::
Localhost is fine for your pvfs2tab file:
echo tcp://localhost:3334/orangefs /pvfsmnt pvfs2 defaults,noauto 0 0 > \
/etc/pvfs2tab
@ -132,7 +136,7 @@ Bootstrap the server::
Start the server::
/opt/osf/sbin/pvfs2-server /etc/pvfs2.conf
/opt/ofs/sbin/pvfs2-server /etc/pvfs2.conf
Now the server should be running. Pvfs2-ls is a simple
test to verify that the server is running::
@ -142,11 +146,11 @@ test to verify that the server is running::
If stuff seems to be working, load the kernel module and
turn on the client core::
/opt/ofs/sbin/pvfs2-client -p /opt/osf/sbin/pvfs2-client-core
/opt/ofs/sbin/pvfs2-client -p /opt/ofs/sbin/pvfs2-client-core
Mount your filesystem::
mount -t pvfs2 tcp://localhost:3334/orangefs /pvfsmnt
mount -t pvfs2 tcp://`hostname`:3334/orangefs /pvfsmnt
Running xfstests

View File

@ -346,23 +346,8 @@ static ssize_t orangefs_file_read_iter(struct kiocb *iocb,
struct iov_iter *iter)
{
int ret;
struct orangefs_read_options *ro;
orangefs_stats.reads++;
/*
* Remember how they set "count" in read(2) or pread(2) or whatever -
* users can use count as a knob to control orangefs io size and later
* we can try to help them fill as many pages as possible in readpage.
*/
if (!iocb->ki_filp->private_data) {
iocb->ki_filp->private_data = kmalloc(sizeof *ro, GFP_KERNEL);
if (!iocb->ki_filp->private_data)
return(ENOMEM);
ro = iocb->ki_filp->private_data;
ro->blksiz = iter->count;
}
down_read(&file_inode(iocb->ki_filp)->i_rwsem);
ret = orangefs_revalidate_mapping(file_inode(iocb->ki_filp));
if (ret)
@ -650,12 +635,6 @@ static int orangefs_lock(struct file *filp, int cmd, struct file_lock *fl)
return rc;
}
static int orangefs_file_open(struct inode * inode, struct file *file)
{
file->private_data = NULL;
return generic_file_open(inode, file);
}
static int orangefs_flush(struct file *file, fl_owner_t id)
{
/*
@ -666,19 +645,8 @@ static int orangefs_flush(struct file *file, fl_owner_t id)
* on an explicit fsync call. This duplicates historical OrangeFS
* behavior.
*/
struct inode *inode = file->f_mapping->host;
int r;
kfree(file->private_data);
file->private_data = NULL;
if (inode->i_state & I_DIRTY_TIME) {
spin_lock(&inode->i_lock);
inode->i_state &= ~I_DIRTY_TIME;
spin_unlock(&inode->i_lock);
mark_inode_dirty_sync(inode);
}
r = filemap_write_and_wait_range(file->f_mapping, 0, LLONG_MAX);
if (r > 0)
return 0;
@ -694,7 +662,7 @@ const struct file_operations orangefs_file_operations = {
.lock = orangefs_lock,
.unlocked_ioctl = orangefs_ioctl,
.mmap = orangefs_file_mmap,
.open = orangefs_file_open,
.open = generic_file_open,
.flush = orangefs_flush,
.release = orangefs_file_release,
.fsync = orangefs_fsync,

View File

@ -259,46 +259,19 @@ static int orangefs_readpage(struct file *file, struct page *page)
pgoff_t index; /* which page */
struct page *next_page;
char *kaddr;
struct orangefs_read_options *ro = file->private_data;
loff_t read_size;
loff_t roundedup;
int buffer_index = -1; /* orangefs shared memory slot */
int slot_index; /* index into slot */
int remaining;
/*
* If they set some miniscule size for "count" in read(2)
* (for example) then let's try to read a page, or the whole file
* if it is smaller than a page. Once "count" goes over a page
* then lets round up to the highest page size multiple that is
* less than or equal to "count" and do that much orangefs IO and
* try to fill as many pages as we can from it.
*
* "count" should be represented in ro->blksiz.
*
* inode->i_size = file size.
* Get up to this many bytes from Orangefs at a time and try
* to fill them into the page cache at once. Tests with dd made
* this seem like a reasonable static number, if there was
* interest perhaps this number could be made setable through
* sysfs...
*/
if (ro) {
if (ro->blksiz < PAGE_SIZE) {
if (inode->i_size < PAGE_SIZE)
read_size = inode->i_size;
else
read_size = PAGE_SIZE;
} else {
roundedup = ((PAGE_SIZE - 1) & ro->blksiz) ?
((ro->blksiz + PAGE_SIZE) & ~(PAGE_SIZE -1)) :
ro->blksiz;
if (roundedup > inode->i_size)
read_size = inode->i_size;
else
read_size = roundedup;
}
} else {
read_size = PAGE_SIZE;
}
if (!read_size)
read_size = PAGE_SIZE;
read_size = 524288;
if (PageDirty(page))
orangefs_launder_page(page);

View File

@ -239,10 +239,6 @@ struct orangefs_write_range {
kgid_t gid;
};
struct orangefs_read_options {
ssize_t blksiz;
};
extern struct orangefs_stats orangefs_stats;
/*