+2001-11-26 Theodore Tso <tytso@valinux.com>
+
+ * unix_io.c (unix_open): Work around a bug in 2.4.10+ kernels by
+ trying to unset the filesize limit if at all possible,
+ if a block device is getting opened. (The filesize limit
+ shouldn't be applied against writes to a block device, but
+ starting in 2.4.10, the kernel is doing this.)
+
2001-11-05 Theodore Tso <tytso@valinux.com>
* mkjournal.c (ext2fs_add_journal_inode): When creating a .journal
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
+#include <sys/resource.h>
#include "ext2_fs.h"
#include "ext2fs.h"
struct unix_private_data *data = NULL;
errcode_t retval;
int open_flags;
+ struct stat st;
if (name == 0)
return EXT2_ET_BAD_DEVICE_NAME;
retval = errno;
goto cleanup;
}
+ /*
+ * Work around a bug in 2.4.10+ kernels where writes to block
+ * devices are wrongly getting hit by the filesize limit.
+ */
+ if ((flags & IO_FLAG_RW) &&
+ (fstat(data->dev, &st) == 0) &&
+ (S_ISBLK(st.st_mode))) {
+ struct rlimit rlim;
+
+ rlim.rlim_cur = RLIM_INFINITY;
+ rlim.rlim_max = RLIM_INFINITY;
+ setrlimit(RLIMIT_FSIZE, &rlim);
+ getrlimit(RLIMIT_FSIZE, &rlim);
+ if (rlim.rlim_cur != rlim.rlim_max) {
+ rlim.rlim_cur = rlim.rlim_max;
+ setrlimit(RLIMIT_FSIZE, &rlim);
+ }
+ }
*channel = io;
return 0;