Closed
Bug 876782
Opened 11 years ago
Closed 11 years ago
AutoMounter shouldn't unmount so agressively
Categories
(Firefox OS Graveyard :: General, defect, P1)
Tracking
(blocking-b2g:leo+, firefox23 wontfix, firefox24 wontfix, firefox25 fixed, b2g18 verified, b2g18-v1.0.0 wontfix, b2g18-v1.0.1 wontfix, b2g-v1.1hd fixed)
People
(Reporter: dhylands, Assigned: dhylands)
References
Details
(Whiteboard: [LeoVB+])
Attachments
(2 files, 3 obsolete files)
13.10 KB,
patch
|
qdot
:
review+
|
Details | Diff | Splinter Review |
1.58 KB,
patch
|
dhylands
:
review+
|
Details | Diff | Splinter Review |
Currently when the AutoMounter tries to unmount a volume, it uses the force option. This in turn causes vold to send a SIGHUP signal to processes which have files open on the volume in question, and eventually kill them. I think that currently, processes may be getting killed when the SIGHUP is being sent. Times when the volume gets unmounted: 1 - When USB Mass Storage is enabled and the phone is plugged into the PC 2 - When the SD card is ejected from the phone For case 1, the AutoMounter should detect that there are still files open and send an event of some type to the app in question so that it can have a chance to do something intelligent. For case 2, The AutoMounter should also send an event. The files will be gone since the sdcard was ejected, but the app should at least be notified that this happened before the automounter initiates the unmount.
Updated•11 years ago
|
blocking-b2g: --- → leo?
Updated•11 years ago
|
blocking-b2g: leo? → leo+
Priority: -- → P1
Target Milestone: --- → 1.1 QE2 (6jun)
Comment 1•11 years ago
|
||
This issue makes so many related issues. If unmount happens during scanning files (in music, gallery, video), it usually makes app crash, media server crash, and various abnormal running. It's very annoying to end-user and easy to find those cases while using the phone. Because of that, I think this issue is very critical to end user.
Comment 2•11 years ago
|
||
Especially, if many files are stored in sdcard, it happens many times.
Comment 3•11 years ago
|
||
Is this bug a duplicate of Bug 871383?? I had reported that bug few weeks ago. Since this bug had became leo+, if they are duplicate, I suggest to close Bug 871383 and keep this one.
Updated•11 years ago
|
Flags: needinfo?(dhylands)
Assignee | ||
Comment 5•11 years ago
|
||
OK - I went and marked bug 871383 as a duplicate. I couldn't find it when I went looking the other day.
Flags: needinfo?(dhylands)
Assignee | ||
Updated•11 years ago
|
Assignee: nobody → dhylands
Assignee | ||
Comment 6•11 years ago
|
||
With the patch as supplied, the automounter will check for open files, and if it finds any, it will add a log entry for each open file, and fail to unmount. This will leave the UI in an inconsistent state, since the UI doesn't know that enabling USB Mass Storage can fail.
Assignee | ||
Comment 7•11 years ago
|
||
Comment on attachment 762848 [details] [diff] [review] WIP: Don't unmount if there are open files Since this is still a WIP, I'm just asking for feedback on what's here so far, realizing that this is probably not yet the complete solution, but at least got the core bits.
Attachment #762848 -
Flags: feedback?(justin.lebar+bug)
Updated•11 years ago
|
Target Milestone: 1.1 QE2 (6jun) → 1.1 QE3 (24jun)
Comment 8•11 years ago
|
||
Comment on attachment 762848 [details] [diff] [review] WIP: Don't unmount if there are open files This looks pretty sane to me!
Attachment #762848 -
Flags: feedback?(justin.lebar+bug) → feedback+
Comment 9•11 years ago
|
||
Resetting milestone as unrealistic with Dave on PTO.
Target Milestone: 1.1 QE3 (24jun) → 1.1 QE4
Comment 10•11 years ago
|
||
Hi Dave, Are you on top of this one still? Thanks
Flags: needinfo?(dhylands)
Assignee | ||
Comment 11•11 years ago
|
||
Yep - it's all coded. I'm doing a couple of cleanups and then I'll find somebody to review it.
Flags: needinfo?(dhylands)
Assignee | ||
Comment 12•11 years ago
|
||
Defers unmount until no files are open on the sdcard. when a unmount is deferred, the automounter will check every 5 seconds to see if files are still open.
Attachment #762848 -
Attachment is obsolete: true
Attachment #771508 -
Flags: review?(kyle)
Comment 13•11 years ago
|
||
Are you planning to get a DOM peer to look at this as well?
Assignee | ||
Comment 14•11 years ago
|
||
(In reply to Justin Lebar [:jlebar] from comment #13) > Are you planning to get a DOM peer to look at this as well? I haven't in the past. As far I can tell, this particular patch doesn't change anything DOM related. I'd be happy to get someone else to review. Who would you recommend?
Comment 15•11 years ago
|
||
> As far I can tell, this particular patch doesn't change anything DOM related.
Indeed it doesn't, even though it's in the dom directory.
I guess the question I should have asked is, have we anointed people to own/review this code, or are we doing it ad-hoc? And I can answer that question: Looking through the blame, this looks like mainly you and qDot.
Is this part of a larger piece of code that we can make you guys official owners of?
Assignee | ||
Comment 16•11 years ago
|
||
The AutoMounter and VolumeXxx files in the dom/system/gonk directory are primarily used for USB Mass Storage, although some of the VolumeXxx stuff is also used by DeviceStorage. I am the primary author of the AutoMounter and VolumeXxx stuff. cjones did the initial review, and I've been getting qDot to do most of the reviews since then (since it's primarily gonk specific). I'm currently the owner of DeviceStorage, and it would make sense for the AutoMounter/VolumeManager to fall under that (or perhaps under a new module - I'm ambivalent).
Comment 17•11 years ago
|
||
Okay, thanks for clarifying!
Comment 18•11 years ago
|
||
Kyle, Please review Dave's changes so we can wrap this up. Thanks! Hema
Comment 19•11 years ago
|
||
Comment on attachment 771508 [details] [diff] [review] Added timer to check every 5 seconds while files are preventing the unmount. Review of attachment 771508 [details] [diff] [review]: ----------------------------------------------------------------- r-'ing just for another go-round on the sscanf. Honestly, if it works and it comes out fine, just fix nits, resubmit and let me know. ::: dom/system/gonk/AutoMounter.cpp @@ +411,5 @@ > + > + // Check to see if there are any open files on the volume and > + // don't initiate the unmount while there are open files. > + OpenFileFinder::Info fileInfo; > + OpenFileFinder fileFinder(vol->MountPoint()); Nit: extra space ::: dom/system/gonk/OpenFileFinder.cpp @@ +126,5 @@ > + char *stat = statString.BeginWriting(); > + if (stat) { > + ReadSysFile(statPath.get(), stat, statString.Length()); > + int ppid; > + if (sscanf(stat, "%*d (%16[^)]) %*c %d ", comm, &ppid) == 2) { Hmm. Wondering if there's a better way we can do this. There's tons of sscanf/PR_sscanf's around the code, but lots of grumbling on #developers about them? Not r-'ing on this, just curious. ::: dom/system/gonk/OpenFileFinder.h @@ +20,5 @@ > + NEXT_PID, > + CHECK_FDS, > + DONE > + }; > + class Info Nit?: struct? (I don't know if we have standards on this)
Attachment #771508 -
Flags: review?(kyle) → review-
Assignee | ||
Comment 20•11 years ago
|
||
(In reply to Kyle Machulis [:kmachulis] [:qdot] from comment #19) > Comment on attachment 771508 [details] [diff] [review] > Added timer to check every 5 seconds while files are preventing the unmount. > > Review of attachment 771508 [details] [diff] [review]: > ----------------------------------------------------------------- > > r-'ing just for another go-round on the sscanf. Honestly, if it works and it > comes out fine, just fix nits, resubmit and let me know. > > ::: dom/system/gonk/OpenFileFinder.cpp > @@ +126,5 @@ > > + char *stat = statString.BeginWriting(); > > + if (stat) { > > + ReadSysFile(statPath.get(), stat, statString.Length()); > > + int ppid; > > + if (sscanf(stat, "%*d (%16[^)]) %*c %d ", comm, &ppid) == 2) { > > Hmm. Wondering if there's a better way we can do this. There's tons of > sscanf/PR_sscanf's around the code, but lots of grumbling on #developers > about them? Not r-'ing on this, just curious. So your nit made me think about this some more, and I realized that it won't work properly if the comm field contains a ) character in it. This would happen if a process with a ) in the name was launched (extremely unlikely) or if an app with a ) in the name (less likely, but still a possibility). There actually is a process called "(Preallocated process)" but the ) is beyond character 16 so it doesn't get included. I'll fix this deal with arbitrary comm, and by then it won't be worth using the sscanf anyore. > > ::: dom/system/gonk/OpenFileFinder.h > @@ +20,5 @@ > > + NEXT_PID, > > + CHECK_FDS, > > + DONE > > + }; > > + class Info > > Nit?: struct? (I don't know if we have standards on this) In previous reviews, I've coded struct and gotten nits to change it to class, so I think its reviewer specific.
Comment 21•11 years ago
|
||
(In reply to Dave Hylands [:dhylands] from comment #20) > > ::: dom/system/gonk/OpenFileFinder.h > > @@ +20,5 @@ > > > + NEXT_PID, > > > + CHECK_FDS, > > > + DONE > > > + }; > > > + class Info > > > > Nit?: struct? (I don't know if we have standards on this) > > In previous reviews, I've coded struct and gotten nits to change it to > class, so I think its reviewer specific. Ok, yeah, that's why I nit?'d. I'll go ahead and change my opinion to class on that too, at least for moz code. I can understand the want for consistency there.
Assignee | ||
Comment 22•11 years ago
|
||
Attachment #776591 -
Flags: review?(kyle)
Assignee | ||
Updated•11 years ago
|
Attachment #771508 -
Attachment is obsolete: true
Assignee | ||
Comment 23•11 years ago
|
||
Bah - forgot to fix the extra space nit.
Attachment #776591 -
Attachment is obsolete: true
Attachment #776591 -
Flags: review?(kyle)
Attachment #776593 -
Flags: review?(kyle)
Comment 24•11 years ago
|
||
Comment on attachment 776593 [details] [diff] [review] Reworked sscanf to work, even when comm has ). Fixed nit Review of attachment 776593 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/system/gonk/OpenFileFinder.cpp @@ +45,5 @@ > + while (mState != DONE) { > + switch (mState) { > + case NEXT_PID: { > + struct dirent *pidEntry; > + pidEntry = readdir(mProcDir); nit: Should probably comment somewhere that we're guaranteed to not block since we're hitting the proc filesystem
Attachment #776593 -
Flags: review?(kyle) → review+
Assignee | ||
Comment 25•11 years ago
|
||
https://hg.mozilla.org/projects/birch/rev/d556762ff012
Comment 26•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/d556762ff012
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Comment 27•11 years ago
|
||
https://hg.mozilla.org/releases/mozilla-b2g18/rev/38a66e499ca8
status-b2g18:
--- → fixed
status-b2g18-v1.0.0:
--- → wontfix
status-b2g18-v1.0.1:
--- → wontfix
status-b2g-v1.1hd:
--- → affected
status-firefox23:
--- → wontfix
status-firefox24:
--- → wontfix
status-firefox25:
--- → fixed
Comment 28•11 years ago
|
||
Backed out for bustage. Looks like this'll need a branch-specific patch for uplift. https://hg.mozilla.org/releases/mozilla-b2g18/rev/8826d586d644 https://tbpl.mozilla.org/php/getParsedLog.php?id=25391760&tree=Mozilla-B2g18
Assignee | ||
Comment 29•11 years ago
|
||
ReadSysFile was factored into FileUtils.h on m-c, and that change wasn't backported to b2g18. Since the ReadSysFile variant used by OpenFileFinder.cpp is available in AutoMounter.cpp, we just expose that function.
Attachment #777400 -
Flags: review+
Flags: needinfo?(dhylands)
Assignee | ||
Comment 30•11 years ago
|
||
https://hg.mozilla.org/releases/mozilla-b2g18/rev/4de723654987 https://hg.mozilla.org/releases/mozilla-b2g18/rev/1be4281f3d27
Comment 31•11 years ago
|
||
https://hg.mozilla.org/releases/mozilla-b2g18_v1_1_0_hd/rev/4de723654987 https://hg.mozilla.org/releases/mozilla-b2g18_v1_1_0_hd/rev/1be4281f3d27
Updated•11 years ago
|
Whiteboard: LeoVB+
Updated•11 years ago
|
Whiteboard: LeoVB+ → [LeoVB+]
Comment 32•11 years ago
|
||
I don't think we need the keyword on here anymore if resolved on branches
Keywords: branch-patch-needed
Comment 33•11 years ago
|
||
storage rescan error after unplug UMS Precondition : Have songs and videos stored on both memories (internal and external). Enable sharing all memories. Test Action : 1) Open music & video. and check file list. 2) Go to home. and plug USB. 3) After a while (30 sec) unplug the cable 4) Go to Music and check 'All Songs' tab view. Detailed Symptom : only internal SD file list show. Expected : music show internal and external file list Reproducibility: Y (Frequency Rate : 100%)
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Comment 34•11 years ago
|
||
Please file a followup bug for the issue you've hit.
Status: REOPENED → RESOLVED
Closed: 11 years ago → 11 years ago
Resolution: --- → FIXED
Comment 35•11 years ago
|
||
Issue does not repros on Leo Build ID: 20130729070226 Gecko: http://hg.mozilla.org/releases/mozilla-b2g18/rev/8135299f3efd Gaia: 7aaffc8ccb6cf7ddd1e97943c108f1cb9eae5de0 Platform Version: 18.1 Result as expected
You need to log in
before you can comment on or make changes to this bug.
Description
•