public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: William Lee Irwin III <wli@holomorphy.com>
To: linux-kernel@vger.kernel.org, akpm@osdl.org, hugh@veritas.com
Subject: force O_LARGEFILE in sys_swapon() and sys_swapoff()
Date: Sat, 3 Jul 2004 23:44:40 -0700	[thread overview]
Message-ID: <20040704064440.GZ21066@holomorphy.com> (raw)
In-Reply-To: <20040704064122.GY21066@holomorphy.com>

On Sat, Jul 03, 2004 at 11:41:22PM -0700, William Lee Irwin III wrote:
> Internal kernel open() of files barfs in important contexts, for
> instance, using strict non-overcommit with enough swap for large
> commitments. This is carried out through the entrypoint filp_open(),
> not sys_open(). sys_open() in turn calls filp_open(). So merely
> moving the forcing of the flag on 64-bit resolves this situation there,
> though not for 32-bit, whose solution is to appear in the sequel.

For 32-bit, one quickly discovers that swapon() is not given an fd
already opened with O_LARGEFILE to act upon and the forcing of
O_LARGEFILE for 64-bit is irrelevant, as the system call's argument is
a path. So this patch manually forces it for swapon() and swapoff().


-- wli

Index: mm5-2.6.7/mm/swapfile.c
===================================================================
--- mm5-2.6.7.orig/mm/swapfile.c	2004-07-02 20:43:30.000000000 -0700
+++ mm5-2.6.7/mm/swapfile.c	2004-07-03 23:12:35.000000000 -0700
@@ -1085,7 +1085,7 @@
 	if (IS_ERR(pathname))
 		goto out;
 
-	victim = filp_open(pathname, O_RDWR, 0);
+	victim = filp_open(pathname, O_RDWR|O_LARGEFILE, 0);
 	putname(pathname);
 	err = PTR_ERR(victim);
 	if (IS_ERR(victim))
@@ -1354,7 +1354,7 @@
 		name = NULL;
 		goto bad_swap_2;
 	}
-	swap_file = filp_open(name, O_RDWR, 0);
+	swap_file = filp_open(name, O_RDWR|O_LARGEFILE, 0);
 	error = PTR_ERR(swap_file);
 	if (IS_ERR(swap_file)) {
 		swap_file = NULL;

  reply	other threads:[~2004-07-04  6:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-04  6:41 move O_LARGEFILE forcing to filp_open() William Lee Irwin III
2004-07-04  6:44 ` William Lee Irwin III [this message]
2004-07-04 19:21   ` force O_LARGEFILE in sys_swapon() and sys_swapoff() Hugh Dickins
2004-07-04 19:31     ` William Lee Irwin III
2004-07-04 12:22 ` move O_LARGEFILE forcing to filp_open() Arnd Bergmann
2004-07-04 16:15   ` William Lee Irwin III
2004-07-04 17:22     ` Arnd Bergmann
2004-07-04 17:27       ` William Lee Irwin III
2004-07-04 17:27         ` William Lee Irwin III
2004-07-04 17:38           ` William Lee Irwin III
2004-07-04 17:49             ` Arnd Bergmann
2004-07-04 17:52               ` William Lee Irwin III
2004-07-04 18:42                 ` William Lee Irwin III

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040704064440.GZ21066@holomorphy.com \
    --to=wli@holomorphy.com \
    --cc=akpm@osdl.org \
    --cc=hugh@veritas.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox