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-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1156537214.26945.6.camel@lappy>
Date:	Fri, 25 Aug 2006 22:20:14 +0200
From:	Peter Zijlstra <a.p.zijlstra@...llo.nl>
To:	Trond Myklebust <trond.myklebust@....uio.no>
Cc:	linux-mm@...ck.org, linux-kernel@...r.kernel.org,
	Andrew Morton <akpm@...l.org>, Rik van Riel <riel@...hat.com>
Subject: Re: [PATCH 4/6] nfs: Teach NFS about swap cache pages

On Fri, 2006-08-25 at 16:03 -0400, Trond Myklebust wrote:
> On Fri, 2006-08-25 at 17:37 +0200, Peter Zijlstra wrote:
> > Teach the NFS client how to treat PG_swapcache pages.
> > 
> > Replace all occurences of page->index and page->mapping in the NFS client
> > with the new page_file_index() and page_file_mapping() functions.
> > 
> > Signed-off-by: Peter Zijlstra <a.p.zijlstra@...llo.nl>
> > ---
> >  fs/nfs/dir.c      |    4 ++--
> >  fs/nfs/file.c     |    6 +++---
> >  fs/nfs/pagelist.c |    8 ++++----
> >  fs/nfs/read.c     |   10 +++++-----
> >  fs/nfs/write.c    |   34 +++++++++++++++++-----------------
> >  5 files changed, 31 insertions(+), 31 deletions(-)
> 
> <snip>
> 
> > @@ -821,7 +821,7 @@ int nfs_updatepage(struct file *file, st
> >  		unsigned int offset, unsigned int count)
> >  {
> >  	struct nfs_open_context *ctx = (struct nfs_open_context *)file->private_data;
> > -	struct inode	*inode = page->mapping->host;
> > +	struct inode	*inode = page_file_mapping(page)->host;
> >  	struct nfs_page	*req;
> >  	int		status = 0;
> >  
> > @@ -854,12 +854,12 @@ int nfs_updatepage(struct file *file, st
> >  		offset = 0;
> >  		if (unlikely(end_offs < 0)) {
> >  			/* Do nothing */
> > -		} else if (page->index == end_index) {
> > +		} else if (page_file_index(page) == end_index) {
> 
> Is this necessary? When will we ever call nfs_updatepage() with a swap
> page? AFAICS, the swap stuff always uses page dirtying and (ugh)
> writepage().

Yes, swap uses writepage(), Nikita Danilov had a patch that did cluster
pageout using writepages(), however that tended to deadlock even on
local disk.

> >  			unsigned int pglen;
> >  			pglen = (unsigned int)(end_offs & (PAGE_CACHE_SIZE-1)) + 1;
> >  			if (count < pglen)
> >  				count = pglen;
> > -		} else if (page->index < end_index)
> > +		} else if (page_file_index(page) < end_index)
> >  			count = PAGE_CACHE_SIZE;
> >  	}
> >  
> > Index: linux-2.6/fs/nfs/dir.c
> > ===================================================================
> > --- linux-2.6.orig/fs/nfs/dir.c
> > +++ linux-2.6/fs/nfs/dir.c
> > @@ -177,7 +177,7 @@ int nfs_readdir_filler(nfs_readdir_descr
> >  
> >  	dfprintk(DIRCACHE, "NFS: %s: reading cookie %Lu into page %lu\n",
> >  			__FUNCTION__, (long long)desc->entry->cookie,
> > -			page->index);
> > +			page_file_index(page));
> >  
> >   again:
> >  	timestamp = jiffies;
> > @@ -201,7 +201,7 @@ int nfs_readdir_filler(nfs_readdir_descr
> >  	 * Note: assumes we have exclusive access to this mapping either
> >  	 *	 through inode->i_mutex or some other mechanism.
> >  	 */
> > -	if (page->index == 0)
> > +	if (page_file_index(page) == 0)
> >  		invalidate_inode_pages2_range(inode->i_mapping, PAGE_CACHE_SIZE, -1);
> >  	unlock_page(page);
> >  	return 0;
> 
> Why are we worried about the possibility of NFS readdir pages being swap
> pages?

Indiscriminate search and replace followed by a manual check for
correctness. They might not be needed, but they're not wrong either.

Would you prefer I take them out?

-
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