public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* Oops when calling fsync on read-only file-system
@ 2011-04-12  1:32 Reuben Dowle
  2011-04-13  7:31 ` Artem Bityutskiy
  0 siblings, 1 reply; 2+ messages in thread
From: Reuben Dowle @ 2011-04-12  1:32 UTC (permalink / raw)
  To: linux-mtd

On my system, calling the fsync system call on any file in a UBI file-system that is mounted read-only leads to a kernel oops. Our system is running a customise version of 2.6.31, but as far as I can see (without testing which is not possible due to extensive vendor customisation of .31 kernel version), the current git branch also contains this bug.

I have created a patch against 2.6.31 that fixes the problem in my system. Perhaps someone could test on latest kernel version.

Signed-off-by: Reuben Dowle <reuben.dowle at navico.com>
---
--- linux-2.6.31.orig/fs/ubifs/io.c	2009-09-10 10:13:59.000000000 +1200
+++ linux-2.6.31/fs/ubifs/io.c	2011-04-11 15:43:50.026527002 +1200
@@ -916,6 +916,14 @@
 {
 	int i, err = 0;
 
+	/* If this is a read-only mount, write buffers will be null
+	 * Skip the sync, returning success (even though this is an invalid operation
+	 * on a read-only file-system, return success because all data on flash
+	 * is up to date)
+	 */
+	if(!c->jheads)
+		return 0;
+
 	for (i = 0; i < c->jhead_cnt; i++) {
 		struct ubifs_wbuf *wbuf = &c->jheads[i].wbuf;
 
---

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-04-13  7:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-12  1:32 Oops when calling fsync on read-only file-system Reuben Dowle
2011-04-13  7:31 ` Artem Bityutskiy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox