Patch for smbfs mtime bug in 2.0.24 (introduced in 2.0.19)

Ulrik Dickow (ukd@kampsax.dk)
Fri, 1 Nov 1996 21:21:35 +0100


Smbfs in kernel 2.0.24 sets file modification times to bogus values.

When I upgraded from 2.0.15 to 2.0.24 today, this bug stunningly appeared.

For example, creating or touching files mounted via smbfs from Windows NT
3.51, 2.0.24 consistently gives me a modification time shown as
"Nov 25 1961" by ls(1) on Linux. (On NT it first appeared as "01-01-70",
then as "01-01-98"). The creation and access times are OK.

This one-line patch cures the problem:

===========================================================================
diff -u linux-2.0.24/fs/smbfs/inode.c.shipped linux-2.0.24/fs/smbfs/inode.c
--- linux-2.0.24/fs/smbfs/inode.c.shipped Fri Nov 1 13:46:13 1996
+++ linux-2.0.24/fs/smbfs/inode.c Fri Nov 1 19:21:30 1996
@@ -126,7 +126,7 @@
struct smb_inode_info *info = SMB_INOP(inode);

int opened = finfo->opened;
- int mtime = finfo->mtime;
+ int mtime = inode->i_mtime;
int file_id = finfo->fileid;
int isdir = S_ISDIR(inode->i_mode);
unsigned long ino = inode->i_ino;
===========================================================================

i.e. get the mtime from `inode->i_mtime' instead of from `finfo->mtime'.
That is consistent with how the mtime was propagated before the 2.0.19 patch:

/* smb_proc_close wants mtime in finfo */
finfo->mtime = inode->i_mtime;
[...]
smb_proc_close(SMB_SERVER(inode), finfo)

After the one-line patch to 2.0.24, the mtime propagates this way:

int mtime = inode->i_mtime;
[...]
smb_proc_close(server, file_id, mtime)

<End of kernel bug report>

While at the subject of smbfs, here's another one-line patch that fixes a
trivial bug in sunsite's smbmount 0.5. Before the patch, it asked for
password twice, ignoring the first answer:

===========================================================================
--- smbfs-0.5/util/smbmount.c.shipped Sun Sep 8 18:57:33 1996
+++ smbfs-0.5/util/smbmount.c Fri Nov 1 18:19:12 1996
@@ -577,7 +577,7 @@
fprintf(stderr, "Password too long\n");
return -1;
}
- strcpy(data.password, getpass("Password: "));
+ strcpy(data.password, pw);
}

if (Upcase_Password == 1)
===========================================================================

Finally, thanks to Paal-Kr. Engstad and Volker Lendecke for creating smbfs.
It makes daily life a lot easier when you're forced to work with Windoze some
of your time.

-- 
Ulrik Dickow                        Snail Mail:  Kampsax Technology
E-mail: ukd@kampsax.dk                           P.O. Box 1142
Phone:  +45 36 39 08 00                          DK-2650 Hvidovre
Fax:    +45 36 77 03 01                          Denmark