rpms/e2fsprogs/F-8 e2fsprogs-1.41.3-check-ro-device.patch, NONE, 1.1 e2fsprogs-1.41.3-exit-preen.patch, NONE, 1.1 e2fsprogs.spec, 1.88, 1.89
Eric Sandeen
sandeen at fedoraproject.org
Mon Oct 13 21:29:49 UTC 2008
- Previous message (by thread): rpms/kernel/F-9 kernel.spec, 1.797, 1.798 linux-2.6-x86-sb450-skip-irq0-override-if-not-routed-to-INT2.patch, 1.1, 1.2
- Next message (by thread): rpms/unicap/devel .cvsignore, 1.6, 1.7 sources, 1.6, 1.7 unicap.spec, 1.8, 1.9
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: sandeen
Update of /cvs/pkgs/rpms/e2fsprogs/F-8
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv25405
Modified Files:
e2fsprogs.spec
Added Files:
e2fsprogs-1.41.3-check-ro-device.patch
e2fsprogs-1.41.3-exit-preen.patch
Log Message:
* Mon Oct 13 2008 Eric Sandeen <esandeen at redhat.com> 1.40.4-3
- Upstream fixes for readonly device errors. (#465679)
e2fsprogs-1.41.3-check-ro-device.patch:
--- NEW FILE e2fsprogs-1.41.3-check-ro-device.patch ---
From: Eric Sandeen <sandeen at redhat.com>
Date: Fri, 10 Oct 2008 22:17:43 +0000 (-0500)
Subject: unix_io: check for read-only devices when opening R/W
X-Git-Tag: v1.41.3~7
X-Git-Url: http://git.kernel.org/?p=fs%2Fext2%2Fe2fsprogs.git;a=commitdiff_plain;h=7ed7a4b6ed8b2fce891874a0eafdc8f77c3ffc34
unix_io: check for read-only devices when opening R/W
When we open a device on linux, test whether it is writable
right away, rather than trying to proceed and clean up when
writes start failing.
Signed-off-by: Eric Sandeen <sandeen at redhat.com>
Signed-off-by: Theodore Ts'o <tytso at mit.edu>
---
diff --git a/lib/ext2fs/unix_io.c b/lib/ext2fs/unix_io.c
index d77e59d..797fce8 100644
--- a/lib/ext2fs/unix_io.c
+++ b/lib/ext2fs/unix_io.c
@@ -31,6 +31,12 @@
#ifdef __linux__
#include <sys/utsname.h>
#endif
+#ifdef HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#endif
+#ifdef HAVE_SYS_MOUNT_H
+#include <sys/mount.h>
+#endif
#if HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
@@ -41,6 +47,10 @@
#include <sys/resource.h>
#endif
+#if defined(__linux__) && defined(_IO) && !defined(BLKGETSIZE)
+#define BLKROGET _IO(0x12, 94) /* Get read-only status (0 = read_write). */
+#endif
+
#include "ext2_fs.h"
#include "ext2fs.h"
@@ -453,6 +463,21 @@ static errcode_t unix_open(const char *name, int flags, io_channel *channel)
goto cleanup;
}
+#ifdef BLKROGET
+ if (flags & IO_FLAG_RW) {
+ int error;
+ int readonly = 0;
+
+ /* Is the block device actually writable? */
+ error = ioctl(data->dev, BLKROGET, &readonly);
+ if (!error && readonly) {
+ close(data->dev);
+ retval = EPERM;
+ goto cleanup;
+ }
+ }
+#endif
+
#ifdef __linux__
#undef RLIM_INFINITY
#if (defined(__alpha__) || ((defined(__sparc__) || defined(__mips__)) && (SIZEOF_LONG == 4)))
e2fsprogs-1.41.3-exit-preen.patch:
--- NEW FILE e2fsprogs-1.41.3-exit-preen.patch ---
From: Eric Sandeen <sandeen at redhat.com>
Date: Fri, 10 Oct 2008 22:14:08 +0000 (-0500)
Subject: e2fsck: exit from preenhalt if IO errors were encountered
X-Git-Tag: v1.41.3~5
X-Git-Url: http://git.kernel.org/?p=fs%2Fext2%2Fe2fsprogs.git;a=commitdiff_plain;h=79cc33628256e817610e921ddf600f72e4f879e1
e2fsck: exit from preenhalt if IO errors were encountered
If a block device is read-only, e2fsck -p gets into an infinite loop
trying to preenhalt, closing and flushing the fs, which tries to flush
the cache, which gets a write error and calls preenhalt which tries to
close and flush the fs ... ad infinitum.
Per Ted's suggestion just flag the ctx as "exiting" and short-circuit
the infinite loop.
Tested by running e2fsck -p on a block device set read-only by BLKROSET.
Thanks to Vlado Potisk for reporting this.
Addresses-Red-Hat-Bugzilla: #465679
Signed-off-by: Eric Sandeen <sandeen at redhat.com>
Signed-off-by: Theodore Ts'o <tytso at mit.edu>
---
diff --git a/e2fsck/e2fsck.h b/e2fsck/e2fsck.h
index 53c8f54..9833248 100644
--- a/e2fsck/e2fsck.h
+++ b/e2fsck/e2fsck.h
@@ -174,6 +174,7 @@ struct resource_track {
#define E2F_FLAG_RESTARTED 0x0200 /* E2fsck has been restarted */
#define E2F_FLAG_RESIZE_INODE 0x0400 /* Request to recreate resize inode */
#define E2F_FLAG_GOT_DEVSIZE 0x0800 /* Device size has been fetched */
+#define E2F_FLAG_EXITING 0x1000 /* E2fsck exiting due to errors */
/*
* Defines for indicating the e2fsck pass number
diff --git a/e2fsck/ehandler.c b/e2fsck/ehandler.c
index 7bae4ab..f9021f0 100644
--- a/e2fsck/ehandler.c
+++ b/e2fsck/ehandler.c
@@ -33,7 +33,8 @@ static errcode_t e2fsck_handle_read_error(io_channel channel,
e2fsck_t ctx;
ctx = (e2fsck_t) fs->priv_data;
-
+ if (ctx->flags & E2F_FLAG_EXITING)
+ return 0;
/*
* If more than one block was read, try reading each block
* separately. We could use the actual bytes read to figure
@@ -79,6 +80,8 @@ static errcode_t e2fsck_handle_write_error(io_channel channel,
e2fsck_t ctx;
ctx = (e2fsck_t) fs->priv_data;
+ if (ctx->flags & E2F_FLAG_EXITING)
+ return 0;
/*
* If more than one block was written, try writing each block
diff --git a/e2fsck/util.c b/e2fsck/util.c
index 256100c..efaea4d 100644
--- a/e2fsck/util.c
+++ b/e2fsck/util.c
@@ -257,6 +257,7 @@ void preenhalt(e2fsck_t ctx)
fprintf(stderr, _("\n\n%s: UNEXPECTED INCONSISTENCY; "
"RUN fsck MANUALLY.\n\t(i.e., without -a or -p options)\n"),
ctx->device_name);
+ ctx->flags |= E2F_FLAG_EXITING;
if (fs != NULL) {
fs->super->s_state |= EXT2_ERROR_FS;
ext2fs_mark_super_dirty(fs);
Index: e2fsprogs.spec
===================================================================
RCS file: /cvs/pkgs/rpms/e2fsprogs/F-8/e2fsprogs.spec,v
retrieving revision 1.88
retrieving revision 1.89
diff -u -r1.88 -r1.89
--- e2fsprogs.spec 29 Feb 2008 17:13:31 -0000 1.88
+++ e2fsprogs.spec 13 Oct 2008 21:29:18 -0000 1.89
@@ -4,7 +4,7 @@
Summary: Utilities for managing the second and third extended (ext2/ext3) filesystems
Name: e2fsprogs
Version: 1.40.4
-Release: 2%{?dist}
+Release: 3%{?dist}
# License based on upstream-modified COPYING file,
# which clearly states "V2" intent.
License: GPLv2
@@ -20,6 +20,8 @@
Patch5: e2fsprogs-1.40.4-sb_feature_check_ignore.patch
Patch7: e2fsprogs-1.40.4-no-static-e2fsck.patch
Patch8: e2fsprogs-1.40.7-lvm-libblkid-errcheck.patch
+Patch9: e2fsprogs-1.41.3-check-ro-device.patch
+Patch10: e2fsprogs-1.41.3-exit-preen.patch
Url: http://e2fsprogs.sourceforge.net/
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -105,6 +107,9 @@
%patch7 -p1 -b .e2fsck-static
# lvm error handling in libblkid
%patch8 -p1 -b .libblkid-lvmerrors
+# fix errors when fscking readonly devices
+%patch9 -p1 -b .ro-dev
+%patch10 -p1 -b .exit-preen
%build
aclocal
@@ -294,6 +299,9 @@
%dir %attr(2775, uuidd, uuidd) /var/lib/libuuid
%changelog
+* Mon Oct 13 2008 Eric Sandeen <esandeen at redhat.com> 1.40.4-3
+- Upstream fixes for readonly device errors. (#465679)
+
* Thu Jan 31 2008 Eric Sandeen <esandeen at redhat.com> 1.40.4-2
- Handle lvm error conditions in libblkid (#433857) (from 1.40.7)
- Previous message (by thread): rpms/kernel/F-9 kernel.spec, 1.797, 1.798 linux-2.6-x86-sb450-skip-irq0-override-if-not-routed-to-INT2.patch, 1.1, 1.2
- Next message (by thread): rpms/unicap/devel .cvsignore, 1.6, 1.7 sources, 1.6, 1.7 unicap.spec, 1.8, 1.9
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the fedora-extras-commits
mailing list