2.2.19 NFSv3 client breaks fdopen(3)

Trond Myklebust (trond.myklebust@fys.uio.no)
Thu, 26 Apr 2001 19:43:19 +0200


>>>>> " " == Matthias Andree <ma@dt.e-technik.uni-dortmund.de> writes:

> Hi, SHORT:

> the current 2.2.19 fs/nfs/dir.c ll. 455ff. nfs_dir_lseek breaks
> fdopen(3) which (at least with glibc 2.1.3) cals __llseek with
> offset==0 and whence==1 (SEEK_CUR), probably to poll the
> current file position. Application software affected comprises
> cvs (tried 1.10.7) and Perl5 (sysopen, see below).

> I suggest that SEEK_CUR be allowed for offset == 0 in
> nfs_dir_llseek, but I'm asking for help since I'm not into this
> and cannot do this on my own. Thanks in advance.

Ion has already sent in a patch to Alan for this. Here it is...

Please note that if glibc is checking this return value, it will still
screw up if file->f_pos > 0x7fffffff, which can and does happen
against certain servers (particularly IRIX).

As I've said before: it is a bug for glibc to be relying on seekdir if
we want to support non-POSIX compliant filesystems under Linux.

Cheers,
Trond

--- /mnt/3/linux-2.2.19/fs/nfs/dir.c Sun Mar 25 08:37:38 2001
+++ linux-2.2.19/fs/nfs/dir.c Thu Apr 5 14:37:59 2001
@@ -454,6 +454,9 @@
*/
static loff_t nfs_dir_llseek(struct file *file, loff_t offset, int origin)
{
+ /* Glibc 2.0 backwards compatibility crap... */
+ if (origin == 1 && offset == 0)
+ return file->f_pos;
/* We disallow SEEK_CUR and SEEK_END */
if (origin != 0)
return -EINVAL;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/