aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/file_storage.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/gadget/file_storage.c')
-rw-r--r--drivers/usb/gadget/file_storage.c18
1 files changed, 1 insertions, 17 deletions
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c
index c4e62a6297d7..2e71368f45b4 100644
--- a/drivers/usb/gadget/file_storage.c
+++ b/drivers/usb/gadget/file_storage.c
@@ -1863,26 +1863,10 @@ static int do_write(struct fsg_dev *fsg)
1863static int fsync_sub(struct lun *curlun) 1863static int fsync_sub(struct lun *curlun)
1864{ 1864{
1865 struct file *filp = curlun->filp; 1865 struct file *filp = curlun->filp;
1866 struct inode *inode;
1867 int rc, err;
1868 1866
1869 if (curlun->ro || !filp) 1867 if (curlun->ro || !filp)
1870 return 0; 1868 return 0;
1871 if (!filp->f_op->fsync) 1869 return vfs_fsync(filp, filp->f_path.dentry, 1);
1872 return -EINVAL;
1873
1874 inode = filp->f_path.dentry->d_inode;
1875 mutex_lock(&inode->i_mutex);
1876 rc = filemap_fdatawrite(inode->i_mapping);
1877 err = filp->f_op->fsync(filp, filp->f_path.dentry, 1);
1878 if (!rc)
1879 rc = err;
1880 err = filemap_fdatawait(inode->i_mapping);
1881 if (!rc)
1882 rc = err;
1883 mutex_unlock(&inode->i_mutex);
1884 VLDBG(curlun, "fdatasync -> %d\n", rc);
1885 return rc;
1886} 1870}
1887 1871
1888static void fsync_all(struct fsg_dev *fsg) 1872static void fsync_all(struct fsg_dev *fsg)