public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steve Rago <sar@nec-labs.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] Allow O_SYNC to be set by fcntl(F_SETFL)
Date: Fri, 25 Feb 2011 16:52:36 -0500	[thread overview]
Message-ID: <4D6824A4.6030009@nec-labs.com> (raw)

This has probably been a problem since day 1 (I ran into this running the 2.4 kernel years ago; finally got around to 
fixing it).  The problem is that fcntl(fd, F_SETFL, flags|O_SYNC) appears to work, but silently ignores the O_SYNC flag. 
  Opening the file with O_SYNC works okay, but setting it later on via fcntl doesn't work.


Signed-off-by: Steve Rago <sar@nec-labs.com>
---
  fs/fcntl.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/fcntl.c b/fs/fcntl.c
index cb10261..afd233a 100644
--- a/fs/fcntl.c
+++ b/fs/fcntl.c
@@ -143,7 +143,7 @@ SYSCALL_DEFINE1(dup, unsigned int, fildes)
         return ret;
  }

-#define SETFL_MASK (O_APPEND | O_NONBLOCK | O_NDELAY | O_DIRECT | O_NOATIME)
+#define SETFL_MASK (O_APPEND | O_NONBLOCK | O_NDELAY | O_DIRECT | O_NOATIME | O_SYNC)

  static int setfl(int fd, struct file * filp, unsigned long arg)
  {
--
1.7.2.1


             reply	other threads:[~2011-02-25 22:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-25 21:52 Steve Rago [this message]
2011-04-07 21:37 ` [PATCH] Allow O_SYNC to be set by fcntl(F_SETFL) Andrew Morton
2011-04-08 15:14   ` Christoph Hellwig
2011-04-08 17:39   ` Steve Rago
2011-04-08 17:56     ` Andrew Morton
2011-04-08 21:08       ` Christoph Hellwig

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=4D6824A4.6030009@nec-labs.com \
    --to=sar@nec-labs.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