Vyom, I did some tests and the problem mentioned below is not relevant to Java. I can't reproduce it with Java testcase.
Sorry for a noise. -Dmitry On 2015-12-18 23:42, vyom wrote: > Hi Dmitry, > > thanks for the review can you please explain little bit more, as per my > testing and implementation i did not found any differences with fix and > without fix. Even i checked the java.io.File.length() and there also it > looks like we are using stat64(). > > as per you mail i truncate the file and with and without fix length is > 102400, can you please explain little bit more about the problem that > you mention it will be help full for me to debug further. > > Thanks, > Vyom > > > On Friday 18 December 2015 05:35 PM, Dmitry Samersoff wrote: >> Vyom, >> >> If I read the changes correctly, current code returns result of lseek() >> but your code returns result of fstat(). >> >> I'm not sure it's a correct replacement. >> >> >> dooku:test#truncate --size=102400 test.me >> >> dooku:test#./test >> STAT: 102400 0 Success >> SEEK: 2 0 Success >> >> Moreover, if you truncate a file to value that large than available free >> space, lseek returns appropriate error but stat - not. >> >> -Dmitry >> >> >> >> On 2015-12-16 11:56, vyom wrote: >>> Hi All, >>> >>> Please find the updated >>> webrev(http://cr.openjdk.java.net/~vtewari/4823133/webrev0.1/ >>> <http://cr.openjdk.java.net/%7Evtewari/4823133/webrev0.1/>). I >>> incorporated the review comments by Roger Riggs. >>> >>> Thanks, >>> Vyom >>> >>> >>> On Tuesday 15 December 2015 10:01 PM, Roger Riggs wrote: >>>> Hi Yvom, >>>> >>>> Minor comments: >>>> >>>> src/java.base/share/native/libjava/RandomAccessFile.c: >>>> - "length fail" might be clearer as "GetLength failed" >>>> >>>> src/java.base/unix/native/libjava/io_util_md.c: >>>> >>>> - Please add a comment before the define of FILE_OFFSET_BITS to >>>> indicate where it is used and why it is there. >>>> - BTW, are there any unintended side effects? >>>> Perhaps a different issue but perhaps 64 bit offsets should be used >>>> everywhere >>>> >>>> src/java.base/windows/native/libjava/io_util_md.c >>>> - Line 592: Using INVALID_HANDLE_VALUE is better than -1 and is used >>>> elsewhere in the file >>>> BTW, Testing for invalid handle might be unnecessary since the call >>>> to GetFileSizeEx will fail >>>> if it is invalid, yielding the same result. >>>> >>>> Roger >>>> >>>> On 12/10/2015 5:52 AM, vyom wrote: >>>>> Hi All, >>>>> >>>>> Please review my changes for below bug. >>>>> >>>>> Bug: JDK-4823133 : RandomAccessFile.length() is not thread-safe >>>>> >>>>> Webrev:http://cr.openjdk.java.net/~vtewari/4823133/webrev0.0/ >>>>> <http://cr.openjdk.java.net/%7Evtewari/4823133/webrev0.0/> >>>>> >>>>> This change ensure that length() does not temporarily changes the >>>>> file pointer and it will make sure that there is no race >>>>> condition in case of multi thread uses. >>>>> >>>>> Thanks, >>>>> Vyom >>>>> >>>>> >>>>> >>>>> >> > -- Dmitry Samersoff Oracle Java development team, Saint Petersburg, Russia * I would love to change the world, but they won't give me the sources.
