Commit 3dc5436aa5719be029bbc2bef0e5cb0312e4ff88

Authored by Aneesh Kumar K.V
Committed by Eric Van Hensbergen
1 parent f10fc50f1a

fs/9p: Writeback dirty data before setattr

change file attribute can result in making the file readonly.
So flush the dirty pages before that.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>

Showing 2 changed files with 8 additions and 0 deletions Side-by-side Diff

... ... @@ -999,6 +999,10 @@
999 999 if (retval)
1000 1000 return retval;
1001 1001 }
  1002 + /* Write all dirty data */
  1003 + if (S_ISREG(dentry->d_inode->i_mode))
  1004 + filemap_write_and_wait(dentry->d_inode->i_mapping);
  1005 +
1002 1006 retval = p9_client_wstat(fid, &wstat);
1003 1007 if (retval < 0)
1004 1008 return retval;
fs/9p/vfs_inode_dotl.c
... ... @@ -459,6 +459,10 @@
459 459 if (retval)
460 460 return retval;
461 461 }
  462 + /* Write all dirty data */
  463 + if (S_ISREG(dentry->d_inode->i_mode))
  464 + filemap_write_and_wait(dentry->d_inode->i_mapping);
  465 +
462 466 retval = p9_client_setattr(fid, &p9attr);
463 467 if (retval < 0)
464 468 return retval;