• Chris Wright's avatar
    Use ERESTART_RESTARTBLOCK if poll() is interrupted by a signal · 3075d9da
    Chris Wright authored
    Lomesh reported poll returning EINTR during suspend/resume cycle.  This is
    caused by the STOP/CONT cycle that the freezer uses, generating a pending
    signal for what in effect is an ignored signal.  In general poll is a
    little eager in returning EINTR, when it could try not bother userspace and
    simply restart the syscall.  Both select and ppoll do use ERESTARTNOHAND to
    restart the syscall.  Oleg points out that simply using ERESTARTNOHAND will
    cause poll to restart with original timeout value.  which could ultimately
    lead to process never returning to userspace.  Instead use
    ERESTART_RESTARTBLOCK, and restart poll with updated timeout value.
    Inspired by Manfred's use ERESTARTNOHAND in poll patch.
    
    [bunk@kernel.org: do_restart_poll() can become static]
    Cc: Manfred Spraul <manfred@colorfullife.com>
    Cc: Oleg Nesterov <oleg@tv-sign.ru>
    Cc: Roland McGrath <roland@redhat.com>
    Cc: "Agarwal, Lomesh" <lomesh.agarwal@intel.com>
    Signed-off-by: default avatarChris Wright <chrisw@sous-sol.org>
    Signed-off-by: default avatarAdrian Bunk <bunk@kernel.org>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    3075d9da
select.c 20.9 KB