linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* fsx failure on ufs2
@ 2007-12-14 16:21 Jean-Marc Saffroy
  2007-12-16 21:10 ` Evgeniy Dushistov
  2008-01-02 20:55 ` Evgeniy Dushistov
  0 siblings, 2 replies; 3+ messages in thread
From: Jean-Marc Saffroy @ 2007-12-14 16:21 UTC (permalink / raw)
  To: daniel.pirkl, dushistov; +Cc: linux-kernel

Hello,

For an embedded system, I'm currently evaluating the robustness of ufs2 
write support on Linux, and my very first test, with fsx, shows serious 
problems.

My test bed is a single CPU PC with a single IDE disk, that boots FreeBSD 
6.2 and Ubuntu 7.10. The kernel on Ubuntu is a vanilla 2.6.23.9 with UFS2 
write support. fsx is from the freebsd cvs (with a small patch to build on 
Linux, see after my sig):
   http://www.freebsd.org/cgi/cvsweb.cgi/src/tools/regression/fsx/

The test is as follows:

# mount -t ufs -o ufstype=ufs2 /dev/sda10 /mnt
(Yes, /dev/sda but it's really IDE.)

$ ./fsx -c100 -N 100000 /mnt/test_fsx

fsx exits in error, after producing the following files:

-rw-r--r-- 1 foo foo 196256 2007-12-14 16:56 test_fsx
-rw-r--r-- 1 foo foo 196256 2007-12-14 16:56 test_fsx.fsxgood
-rw-r--r-- 1 foo foo  63167 2007-12-14 16:56 test_fsx.fsxlog

The file test_fsx.fsxgood contains what fsx expected to be in test_fsx; 
the files differ only in the last 4K chunk (it seems there should be only 
zeroes, but it's not so).

There does not seem to be any problem with ext3.

Can anyone else confirm this problem?


Cheers,

-- 
Jean-Marc Saffroy - Silicomp / Orange Business Services
mailto:jean-marc.saffroy@orange-ftgroup.com

Trivial patch for fsx.

diff -r 6888f21e18de -r 1aa7894fc4f8 fsx.c
--- a/fsx.c	Thu Dec 13 17:51:02 2007 +0100
+++ b/fsx.c	Thu Dec 13 17:52:08 2007 +0100
@@ -61,6 +61,8 @@
  #include <unistd.h>
  #include <stdarg.h>
  #include <errno.h>
+#include <stdint.h>
+#include <time.h>

  #define NUMPRINTCOLUMNS 32	/* # columns of data to print on each line */


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

* Re: fsx failure on ufs2
  2007-12-14 16:21 fsx failure on ufs2 Jean-Marc Saffroy
@ 2007-12-16 21:10 ` Evgeniy Dushistov
  2008-01-02 20:55 ` Evgeniy Dushistov
  1 sibling, 0 replies; 3+ messages in thread
From: Evgeniy Dushistov @ 2007-12-16 21:10 UTC (permalink / raw)
  To: Jean-Marc Saffroy; +Cc: daniel.pirkl, linux-kernel

On Fri, Dec 14, 2007 at 05:21:31PM +0100, Jean-Marc Saffroy wrote:
> For an embedded system, I'm currently evaluating the robustness of ufs2 
> write support on Linux, and my very first test, with fsx, shows serious 
> problems.
>
> My test bed is a single CPU PC with a single IDE disk, that boots FreeBSD 
> 6.2 and Ubuntu 7.10. The kernel on Ubuntu is a vanilla 2.6.23.9 with UFS2 
> write support. fsx is from the freebsd cvs (with a small patch to build on 
> Linux, see after my sig):
>   http://www.freebsd.org/cgi/cvsweb.cgi/src/tools/regression/fsx/
>

I used fsx-linux.c from ext3-tools project, but ran it with
different options.

>
> Can anyone else confirm this problem?
>
Using your options I am able to reproduce this bug.
Looks like problem in ufs_alloc_lastblock, last page in file
contains zeros, but because of ufs_readpage, it can be contains 
garbage. I will look at next week how it can be fixed.

-- 
/Evgeniy


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

* Re: fsx failure on ufs2
  2007-12-14 16:21 fsx failure on ufs2 Jean-Marc Saffroy
  2007-12-16 21:10 ` Evgeniy Dushistov
@ 2008-01-02 20:55 ` Evgeniy Dushistov
  1 sibling, 0 replies; 3+ messages in thread
From: Evgeniy Dushistov @ 2008-01-02 20:55 UTC (permalink / raw)
  To: Jean-Marc Saffroy; +Cc: daniel.pirkl, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 639 bytes --]

Hi, sorry for delay.

On Fri, Dec 14, 2007 at 05:21:31PM +0100, Jean-Marc Saffroy wrote:
> For an embedded system, I'm currently evaluating the robustness of ufs2 
> write support on Linux, and my very first test, with fsx, shows serious 
> problems.
>
> My test bed is a single CPU PC with a single IDE disk, that boots FreeBSD 
> 6.2 and Ubuntu 7.10. The kernel on Ubuntu is a vanilla 2.6.23.9 with UFS2 
> write support. fsx is from the freebsd cvs (with a small patch to build on 
> Linux, see after my sig):
>   http://www.freebsd.org/cgi/cvsweb.cgi/src/tools/regression/fsx/
>

Can you try this patch (see attachment)?

-- 
/Evgeniy

[-- Attachment #2: ufs_truncate_zero_fix.patch --]
[-- Type: text/plain, Size: 2544 bytes --]

diff --git a/fs/ufs/balloc.c b/fs/ufs/balloc.c
index f63a09c..572b145 100644
--- a/fs/ufs/balloc.c
+++ b/fs/ufs/balloc.c
@@ -404,6 +404,7 @@ u64 ufs_new_fragments(struct inode *inode, void *p, u64 fragment,
 		if (tmp) {
 			UFSD("EXIT (ALREADY ALLOCATED)\n");
 			unlock_super(sb);
+			*err = 0;
 			return 0;
 		}
 	}
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c
index 4320782..34ce4fb 100644
--- a/fs/ufs/inode.c
+++ b/fs/ufs/inode.c
@@ -273,6 +273,8 @@ repeat:
 		tmp = ufs_new_fragments(inode, p, fragment - blockoff,
 					goal, uspi->s_fpb, err,
 					phys != NULL ? locked_page : NULL);
+		if (!tmp && ufs_data_ptr_to_cpu(sb, p))
+			goto repeat;
 	}
 	if (!tmp) {
 		if ((!blockoff && ufs_data_ptr_to_cpu(sb, p)) ||
@@ -423,10 +425,13 @@ int ufs_getfrag_block(struct inode *inode, sector_t fragment, struct buffer_head
 	u64 phys64 = 0;
 	
 	if (!create) {
-		phys64 = ufs_frag_map(inode, fragment);
-		UFSD("phys64 = %llu\n", (unsigned long long)phys64);
-		if (phys64)
-			map_bh(bh_result, sb, phys64);
+		if (fragment < UFS_I(inode)->i_lastfrag) {		      
+			phys64 = ufs_frag_map(inode, fragment);
+			if (phys64)
+				map_bh(bh_result, sb, phys64);
+		}
+		UFSD("fragment %llu, phys64 = %llu\n",
+		     (unsigned long long)fragment, (unsigned long long)phys64);
 		return 0;
 	}
 
@@ -502,6 +507,7 @@ out:
 	map_bh(bh_result, sb, phys);
 abort:
 	unlock_kernel();
+	UFSD("EXIT: err %d, new %d\n", err, new);
 	return err;
 
 abort_negative:
diff --git a/fs/ufs/truncate.c b/fs/ufs/truncate.c
index 311ded3..ef09426 100644
--- a/fs/ufs/truncate.c
+++ b/fs/ufs/truncate.c
@@ -390,6 +390,7 @@ static int ufs_alloc_lastblock(struct inode *inode)
 	u64 phys64;
 
 	lastfrag = (i_size_read(inode) + uspi->s_fsize - 1) >> uspi->s_fshift;
+	UFSD("BEGIN lastfrag %llu\n", (unsigned long long)lastfrag);
 
 	if (!lastfrag)
 		goto out;
@@ -418,13 +419,13 @@ static int ufs_alloc_lastblock(struct inode *inode)
 	       clear_buffer_new(bh);
 	       unmap_underlying_metadata(bh->b_bdev,
 					 bh->b_blocknr);
-	       /*
-		* we do not zeroize fragment, because of
-		* if it maped to hole, it already contains zeroes
-		*/
-	       set_buffer_uptodate(bh);
-	       mark_buffer_dirty(bh);
-	       set_page_dirty(lastpage);
+	       if (!buffer_dirty(bh)) {
+		       zero_user_page(lastpage, end * sb->s_blocksize,
+				      sb->s_blocksize, KM_USER0);
+		       set_buffer_uptodate(bh);
+		       mark_buffer_dirty(bh);
+		       set_page_dirty(lastpage);
+	       }	       
        }
 
        if (lastfrag >= UFS_IND_FRAGMENT) {

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

end of thread, other threads:[~2008-01-02 20:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-14 16:21 fsx failure on ufs2 Jean-Marc Saffroy
2007-12-16 21:10 ` Evgeniy Dushistov
2008-01-02 20:55 ` Evgeniy Dushistov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).