Commit 7e732bfc5570b8f9bb5f155cf36e94b2e7d6bf6a
Committed by
Linus Torvalds
1 parent
0f36b018b2
Exists in
master
and in
4 other branches
[PATCH] Fix regression added by ppoll/pselect code.
The compat layer timeout handling changes in: 9f72949f679df06021c9e43886c9191494fdb007 are busted. This is most easily seen with an X application that uses sub-second select/poll timeout such as emacs. You hit a key and it takes a second or so before the app responds. The two ROUND_UP() calls upon entry are using {tv,ts}_sec where it should instead be using {tv_usec,ts_nsec}, which perfectly explains the observed incorrect behavior. Another bug shot down with git bisect. Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Showing 1 changed file with 2 additions and 2 deletions Side-by-side Diff
fs/compat.c
| ... | ... | @@ -1743,7 +1743,7 @@ |
| 1743 | 1743 | if ((u64)tv.tv_sec >= (u64)MAX_INT64_SECONDS) |
| 1744 | 1744 | timeout = -1; /* infinite */ |
| 1745 | 1745 | else { |
| 1746 | - timeout = ROUND_UP(tv.tv_sec, 1000000/HZ); | |
| 1746 | + timeout = ROUND_UP(tv.tv_usec, 1000000/HZ); | |
| 1747 | 1747 | timeout += tv.tv_sec * HZ; |
| 1748 | 1748 | } |
| 1749 | 1749 | } |
| ... | ... | @@ -1884,7 +1884,7 @@ |
| 1884 | 1884 | /* We assume that ts.tv_sec is always lower than |
| 1885 | 1885 | the number of seconds that can be expressed in |
| 1886 | 1886 | an s64. Otherwise the compiler bitches at us */ |
| 1887 | - timeout = ROUND_UP(ts.tv_sec, 1000000000/HZ); | |
| 1887 | + timeout = ROUND_UP(ts.tv_nsec, 1000000000/HZ); | |
| 1888 | 1888 | timeout += ts.tv_sec * HZ; |
| 1889 | 1889 | } |
| 1890 | 1890 |