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: <20120628082725.33b71097@corrin.poochiereds.net>
Date:	Thu, 28 Jun 2012 08:27:25 -0400
From:	Jeff Layton <jlayton@...hat.com>
To:	Mel Gorman <mgorman@...e.de>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Linux-MM <linux-mm@...ck.org>,
	Linux-Netdev <netdev@...r.kernel.org>,
	Linux-NFS <linux-nfs@...r.kernel.org>,
	LKML <linux-kernel@...r.kernel.org>,
	David Miller <davem@...emloft.net>,
	Trond Myklebust <Trond.Myklebust@...app.com>,
	Neil Brown <neilb@...e.de>,
	Christoph Hellwig <hch@...radead.org>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Mike Christie <michaelc@...wisc.edu>,
	Eric B Munson <emunson@...bm.net>
Subject: Re: [PATCH 10/12] nfs: enable swap on NFS

On Fri, 22 Jun 2012 15:31:06 +0100
Mel Gorman <mgorman@...e.de> wrote:

> Implement the new swapfile a_ops for NFS and hook up ->direct_IO. This
> will set the NFS socket to SOCK_MEMALLOC and run socket reconnect
> under PF_MEMALLOC as well as reset SOCK_MEMALLOC before engaging the
> protocol ->connect() method.
> 
> PF_MEMALLOC should allow the allocation of struct socket and related
> objects and the early (re)setting of SOCK_MEMALLOC should allow us
> to receive the packets required for the TCP connection buildup.
> 
> [dfeng@...hat.com: Fix handling of multiple swap files]
> [a.p.zijlstra@...llo.nl: Original patch]
> Signed-off-by: Mel Gorman <mgorman@...e.de>
> Acked-by: Rik van Riel <riel@...hat.com>
> ---
>  fs/nfs/Kconfig              |    8 +++++
>  fs/nfs/direct.c             |   82 ++++++++++++++++++++++++++++---------------
>  fs/nfs/file.c               |   22 ++++++++++--
>  include/linux/nfs_fs.h      |    4 +--
>  include/linux/sunrpc/xprt.h |    3 ++
>  net/sunrpc/Kconfig          |    5 +++
>  net/sunrpc/clnt.c           |    2 ++
>  net/sunrpc/sched.c          |    7 ++--
>  net/sunrpc/xprtsock.c       |   53 ++++++++++++++++++++++++++++
>  9 files changed, 152 insertions(+), 34 deletions(-)
> 

[...snip...]

> @@ -2108,11 +2156,15 @@ static void xs_tcp_setup_socket(struct work_struct *work)
>  		container_of(work, struct sock_xprt, connect_worker.work);
>  	struct socket *sock = transport->sock;
>  	struct rpc_xprt *xprt = &transport->xprt;
> +	unsigned long pflags = current->flags;
>  	int status = -EIO;
>  
>  	if (xprt->shutdown)
>  		goto out;
>  
> +	if (xprt->swapper)
> +		current->flags |= PF_MEMALLOC;
> +
>  	if (!sock) {
>  		clear_bit(XPRT_CONNECTION_ABORT, &xprt->state);
>  		sock = xs_create_sock(xprt, transport,
> @@ -2174,6 +2226,7 @@ out_eagain:
>  out:
>  	xprt_clear_connecting(xprt);
>  	xprt_wake_pending_tasks(xprt, status);
> +	tsk_restore_flags(current, pflags, PF_MEMALLOC);
>  }
>  
>  /**

Apologies if this is fixed in another patch and I didn't see it...

There's a place in the above function that returns without going
through "out:". I think you also want to tsk_restore_flags() in that
spot too.

-- 
Jeff Layton <jlayton@...hat.com>
--
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