From: Valdis.Kletnieks@vt.edu (Valdis.Kletnieks at vt.edu) Date: Fri, 26 Jul 2013 10:59:25 -0400 Subject: Direct IO and Page cache In-Reply-To: Your message of "Fri, 26 Jul 2013 00:02:31 -0400." <20130726040231.GD8707@gmail.com> References: <20130726031549.GB8707@gmail.com> <20130726040231.GD8707@gmail.com> Message-ID: <38106.1374850765@turing-police.cc.vt.edu> To: kernelnewbies@lists.kernelnewbies.org List-Id: kernelnewbies.lists.kernelnewbies.org On Fri, 26 Jul 2013 00:02:31 -0400, Kumar amit mehta said: > So leaving the hardware at the mercy of the application doesn't sound > like a good practice. This __may__ compromise kernel stability too. Also > think of this: In what possible way does it compromise kernel stability?: > > In app1: > fdx = open("blah" , O_RW|O_DIRECT); > write(fdx,buf,sizeof(buf)); > > In app2(unaware of app1): > fdy = open("blah", O_RW); > write(fdy,buf, sizeof(buf)); > > I think this isn't highly unlikely to do, and if you agree with me then > we may end up with same could-be/would-be data-corruption. Now who should > be blamed here, app1, app2 You blame the idiot programmer who didn't use file locking, and/or the idiot user who ran the two programs. This isn't even about O_DIRECT - try writing two programs that both basically do a 'write 1M of data, sleep 10 seconds' using stdio to the same file, and see what happens.... -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 865 bytes Desc: not available Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130726/4cd548f7/attachment.bin