unix_io.c (unix_open): Only attempt the setrlimit workaround if

the kernel version is 2.4.10 -- 2.4.17, since otherwise an
	old version of glibc (built against 2.2 headers) will
	interact badly with the workaround to actually cause more
	problems.  I hate it when the glibc folks think they're
	being smarter than the kernel....
bitmap-optimize
Theodore Ts'o 2002-07-14 08:33:32 -04:00
parent 7098810daf
commit f154d2f687
2 changed files with 26 additions and 3 deletions

View File

@ -1,3 +1,12 @@
2002-07-14 Theodore Ts'o <tytso@mit.edu>
* unix_io.c (unix_open): Only attempt the setrlimit workaround if
the kernel version is 2.4.10 -- 2.4.17, since otherwise an
old version of glibc (built against 2.2 headers) will
interact badly with the workaround to actually cause more
problems. I hate it when the glibc folks think they're
being smarter than the kernel....
2002-06-28 Andreas Dilger <adilger@clusterfs.com>
* ext2_fs.h: Add superblock field for reserved group descriptors.

View File

@ -25,6 +25,9 @@
#endif
#include <fcntl.h>
#include <time.h>
#ifdef __linux__
#include <sys/utsname.h>
#endif
#if HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
@ -296,6 +299,9 @@ static errcode_t unix_open(const char *name, int flags, io_channel *channel)
errcode_t retval;
int open_flags;
struct stat st;
#ifdef __linux__
struct utsname ut;
#endif
if (name == 0)
return EXT2_ET_BAD_DEVICE_NAME;
@ -347,10 +353,18 @@ static errcode_t unix_open(const char *name, int flags, io_channel *channel)
#define RLIM_INFINITY (~0UL)
#endif
/*
* Work around a bug in 2.4.10+ kernels where writes to block
* devices are wrongly getting hit by the filesize limit.
* Work around a bug in 2.4.10-2.4.18 kernels where writes to
* block devices are wrongly getting hit by the filesize
* limit. This workaround isn't perfect, since it won't work
* if glibc wasn't built against 2.2 header files. (Sigh.)
*
*/
if ((flags & IO_FLAG_RW) &&
if ((flags & IO_FLAG_RW) &&
(uname(&ut) == 0) &&
((ut.release[0] == '2') && (ut.release[1] == '.') &&
(ut.release[2] == '4') && (ut.release[3] == '.') &&
(ut.release[4] == '1') && (ut.release[5] >= '0') &&
(ut.release[5] < '8')) &&
(fstat(data->dev, &st) == 0) &&
(S_ISBLK(st.st_mode))) {
struct rlimit rlim;