kernels/linux-2.4.0/fs/smbfs/proc.c
/*
 * Called with the server locked.
 *
 * Win NT 4.0 has an apparent bug in that it fails to update the
 * modify time when writing to a file. As a workaround, we update
 * both modify and access time locally, and post the times to the
 * server when closing the file.
 */
Called with the server locked.
Win NT 4.0 has an apparent bug in that it fails to update the
modify time when writing to a file. As a workaround, we update
both modify and access time locally, and post the times to the
server when closing the file.
Called with the server locked . Win NT 4 . 0 has an apparent bug in that it fails to update the modify time when writing to a file . As a workaround we update both modify and access time locally and post the times to the server when closing the file .
static int 
smb_proc_close_inode(struct smb_sb_info *server, struct inode * ino)
{
	int result = 0;
	if (smb_is_open(ino))
	{
		ino->u.smbfs_i.open = 0;
		if (ino->i_mtime & 1)
			ino->i_mtime--;
		if (ino->i_atime & 1)
			ino->i_atime--;
		if ((server->opt.protocol >= SMB_PROTOCOL_LANMAN2) &&
		    !(ino->u.smbfs_i.access == SMB_O_RDONLY))
		{
			struct smb_fattr fattr;
			smb_get_inode_attr(ino, &fattr);
			smb_proc_setattr_ext(server, ino, &fattr);
		}
		result = smb_proc_close(server, ino->u.smbfs_i.fileid,
						ino->i_mtime);
		ino->u.smbfs_i.cache_valid &= ~SMB_F_LOCALWRITE;
		if (server->opt.protocol < SMB_PROTOCOL_NT1)
			ino->u.smbfs_i.oldmtime = 0;
		ino->u.smbfs_i.closed = jiffies;
	}
	return result;
}
static int smb_proc_close_inode ( struct smb_sb_info * server , struct inode * ino ) { int result = 0 ; if ( smb_is_open ( ino ) ) { ino -> u . smbfs_i . open = 0 ; if ( ino -> i_mtime & 1 ) ino -> i_mtime -- ; if ( ino -> i_atime & 1 ) ino -> i_atime -- ; if ( ( server -> opt . protocol >= SMB_PROTOCOL_LANMAN2 ) && ! ( ino -> u . smbfs_i . access == SMB_O_RDONLY ) ) { struct smb_fattr fattr ; smb_get_inode_attr ( ino , & fattr ) ; smb_proc_setattr_ext ( server , ino , & fattr ) ; } result = smb_proc_close ( server , ino -> u . smbfs_i . fileid , ino -> i_mtime ) ; ino -> u . smbfs_i . cache_valid &= ~ SMB_F_LOCALWRITE ; if ( server -> opt . protocol < SMB_PROTOCOL_NT1 ) ino -> u . smbfs_i . oldmtime = 0 ; ino -> u . smbfs_i . closed = jiffies ; } return result ; }
Called with the server locked.
Called with the server locked .
/*
		 * We clear the open flag in advance, in case another
 		 * process observes the value while we block below.
		 */ /*
		 * Kludge alert: SMB timestamps are accurate only to
		 * two seconds ... round the times to avoid needless
		 * cache invalidations!
		 */ /*
		 * If the file is open with write permissions,
		 * update the time stamps to sync mtime and atime.
		 */ /*
		 * Force a revalidation after closing ... some servers
		 * don't post the size until the file has been closed.
		 */