s3 onefs: Fix a race condition exists in onefs_open.c between multiple opens to the...
authorSteven Danneman <steven.danneman@isilon.com>
Thu, 14 May 2009 23:12:23 +0000 (23:12 +0000)
committerTim Prouty <tprouty@samba.org>
Thu, 24 Sep 2009 18:31:21 +0000 (11:31 -0700)
commit74c0a7a1d34a75abec32cc46ab0b02b483160215
treeb2a28dd2d7c7ad6db3ad7492da1bd25cf2072d05
parent5e9aade51657a22dba2c65ffc1aab1be7c532e61
s3 onefs: Fix a race condition exists in onefs_open.c between multiple opens to the same file.

Two openers can stat a file at the same time, see that it doesn't exist,
and then both race to open it first.  The loser will enter
onefs_open_file_ntcreate believing that the file doesnt exist, and thus
skip any current state lookups for that file.  This includes setting
the file_id, and having a valid stat buffer.

Normally on first create the file_id will be set during the open, but
the second opener in this scenario may fail the open (oplock/share mode)
and file_id will not be set, nor will the stat buffer be valid.

In the error paths of this patch, we now double check that the file_id
and the stat buffer are valid before doing other operations.
source3/modules/onefs_open.c