On 02/07/2012 03:47 PM, Stefan Hajnoczi wrote:
On Wed, Feb 01, 2012 at 08:37:12AM +0530, Supriya Kannery wrote:
+    /* stash state before reopen */
+    raw_rs->stash_s = g_malloc0(sizeof(BDRVRawState));
+    memcpy(raw_rs->stash_s, s, sizeof(BDRVRawState));

Copying a struct is fragile, Mike Roth pointed out the potential issue
with aligned_buf.

If raw-posix could open from a given file descriptor as an alternative
to opening a filename, then it would be clean and natural to simply
re-initialize from the dup'd file descriptor in the abort case.  That's
the approach I would try instead of stashing the whole struct.

Stefan


fine, will get V1 with stashing of only required fields wherever
possible instead of stashing the full struct.


Reply via email to