Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!uupsi!sunic!isgate!krafla!einari From: einari@rhi.hi.is (Einar Indridason) Newsgroups: comp.os.minix Subject: Re: (PC/AT) why not include 'sync' in keyboard.c (for rebooting?) Message-ID: <3058@krafla.rhi.hi.is> Date: 17 Apr 91 17:17:27 GMT References: <50809@nigel.ee.udel.edu> <1991Apr15.210247.26781@cmcl2.nyu.edu> Reply-To: einari@rhi.hi.is (Einar Indridason) Organization: University of Iceland (RHI) Lines: 52 In article <1991Apr15.210247.26781@cmcl2.nyu.edu> jai@lab.ultra.nyu.edu (Benchiao Jai) writes: >The kernel can send a message to fs telling it to execute a sync, but >this operation is not atomic, so other things may happen in between. >Picture this: keyboard driver send sync request to fs > fs sends a write request to disk task > disk task executes the request and send SUSPEND to fs > fs suspends keyboard task and fetches another request from user > (this is possible since no higher priority tasks can be run > at this moment) > fs executes the new write request by putting the new data > into buffer cache > disk task replies OK > fs revives keyboard task and send an OK reply > keyboard proceeds to reboot >BOOM! Buffer cache is still dirty. > Ok. I understand. Since it was me who started this discussion I might say something :-) Well, to start with: fifteen minutes after I posted my query I thought of a situation that could be invalid. It is in the same lines as the above quotation is. (We had a disk crash shortly after I posted my query, so I might have missed something of the early discussion of it :-/ In short: My thought was not quite correct. It is *not* ok to put 'sync()' in 'keyboard.c' to flush buffers to the filesystem before rebooting. Thanks to those who pointed it to me. One of them suggested the following solution: (usable if you are the only user on the machine and not neccessary using the virtual consoles patch, (which I haven't installed yet)) Create an account with a login shell composed of a simple C program that contain a loop surrounding a 'sync()' call. Wait until all drive-access lights have gone out. Boot the machine. Well, thats enough for now. (You just wait for my next question :-) -- Internet: einari@rhi.hi.is | "Just give me my command line and drag UUCP: ..!mcsun!isgate!rhi!einari | the GUIs to the waste basket!!!!" Surgeon Generals warning: Masking the 8th bit can seriously damage your brain!!