diff options
| author | Rolf Fokkens <fokkensr@fokkensr.vertis.nl> | 2002-09-30 09:41:12 -0400 |
|---|---|---|
| committer | James Bottomley <jejb@mulgrave.(none)> | 2002-09-30 09:41:12 -0400 |
| commit | 8885e3758a2d4d90cb08ccb10ad3b648e6ed08b0 (patch) | |
| tree | 07615307d7471c7165b6b321ebb7fa04db104683 /include | |
| parent | dfa944ae6564ed0601324b0b46e72a4a9ac6f82d (diff) | |
[PATCH] sg.c and USER_HZ, kernel 2.5.37
Hi!
Since the introduction of USER_HZ the SG_[GS]ET_TIMEOUT ioctls may have
a serious BUG as userspace uses a different HZ from the HZ in kernelspace.
In x86 HZ=1000 and USER_HZ=100, resulting in confusing timouts as the
kernel measures time 10 times as fast as userspace.
This patch is an attempt to fix this by transforming USER_HZ based timing to
HZ based timing before storing it in timeout. To make sure that SG_GET_TIMEOUT
and SG_SET_TIMEOUT behave consistently a field timeout_user is added which
stores the exact value that's passed by SG_SET_TIMEOUT and it's returned on
SG_GET_TIMEOUT.
Rolf Fokkens
fokkensr@fokkensr.vertis.nl
P.S. this is the second post of this patch
Diffstat (limited to 'include')
| -rw-r--r-- | include/scsi/sg.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/include/scsi/sg.h b/include/scsi/sg.h index 9ffc9f960c7e..ddf83957b343 100644 --- a/include/scsi/sg.h +++ b/include/scsi/sg.h @@ -304,7 +304,12 @@ struct sg_header /* Defaults, commented if they differ from original sg driver */ -#define SG_DEFAULT_TIMEOUT (60*HZ) /* HZ == 'jiffies in 1 second' */ +#ifdef __KERNEL__ +#define SG_DEFAULT_TIMEOUT_USER (60*USER_HZ) /* HZ == 'jiffies in 1 second' */ +#else +#define SG_DEFAULT_TIMEOUT (60*HZ) /* HZ == 'jiffies in 1 second' */ +#endif + #define SG_DEF_COMMAND_Q 0 /* command queuing is always on when the new interface is used */ #define SG_DEF_UNDERRUN_FLAG 0 |
