Quoting Dwight Engen (dwight.en...@oracle.com): > On Tue, 12 Nov 2013 14:42:54 -0600 > Serge Hallyn <serge.hal...@ubuntu.com> wrote: > > > Quoting Dwight Engen (dwight.en...@oracle.com): > > > This is likely unnecessary, but is consistent with other uses of > > > fopen()/fclose() in lxc. > > > > > > Signed-off-by: Dwight Engen <dwight.en...@oracle.com> > > > > Do you think, regardless of your other fix, that it would still be > > worth adding an fsync? > > Hmm, good question. I guess its possible lxcapi_save_config() could be > called by two different user processes for the same container and we'd
They'd be protected by container_mem_lock(), but I think you've shown that's not enough. Which might mean that what we need is to always fsync c->configfile at end of container_mem_lock()... > wind up with a similar situation. Seems like we're trying to use the > disk lock to protect against that, but it wasn't enough so maybe we do > need the fflush and fsync in there too. I think I'd have to write a > test to show the corruption and also then that the fflush and fsync > fixes it like it did for the create() flow to convince myself :) > > > > > Acked-by: Serge E. Hallyn <serge.hal...@ubuntu.com> > > > > > --- > > > src/lxc/lxccontainer.c | 4 ++++ > > > 1 file changed, 4 insertions(+) > > > > > > diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c > > > index ede0113..c7b2f5e 100644 > > > --- a/src/lxc/lxccontainer.c > > > +++ b/src/lxc/lxccontainer.c > > > @@ -1696,11 +1696,15 @@ static bool lxcapi_save_config(struct > > > lxc_container *c, const char *alt_file) if (lret) > > > return false; > > > > > > + process_lock(); > > > fout = fopen(alt_file, "w"); > > > + process_unlock(); > > > if (!fout) > > > goto out; > > > write_config(fout, c->lxc_conf); > > > + process_lock(); > > > fclose(fout); > > > + process_unlock(); > > > ret = true; > > > > > > out: > > > -- > > > 1.8.3.1 > > > > > > > > > ------------------------------------------------------------------------------ > > > DreamFactory - Open Source REST & JSON Services for HTML5 & Native > > > Apps OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API > > > Access Free app hosting. Or install the open source package on any > > > LAMP server. Sign up and see examples for AngularJS, jQuery, Sencha > > > Touch and Native! > > > http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk > > > _______________________________________________ Lxc-devel mailing > > > list Lxc-devel@lists.sourceforge.net > > > https://lists.sourceforge.net/lists/listinfo/lxc-devel > ------------------------------------------------------------------------------ DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access Free app hosting. Or install the open source package on any LAMP server. Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native! http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk _______________________________________________ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel