|
@@ -324,8 +324,8 @@ out_cleanup:
|
|
* is possible that the copy up will lock the old parent. At that point
|
|
* is possible that the copy up will lock the old parent. At that point
|
|
* the file will have already been copied up anyway.
|
|
* the file will have already been copied up anyway.
|
|
*/
|
|
*/
|
|
-int ovl_copy_up_one(struct dentry *parent, struct dentry *dentry,
|
|
|
|
- struct path *lowerpath, struct kstat *stat)
|
|
|
|
|
|
+static int ovl_copy_up_one(struct dentry *parent, struct dentry *dentry,
|
|
|
|
+ struct path *lowerpath, struct kstat *stat)
|
|
{
|
|
{
|
|
DEFINE_DELAYED_CALL(done);
|
|
DEFINE_DELAYED_CALL(done);
|
|
struct dentry *workdir = ovl_workdir(dentry);
|
|
struct dentry *workdir = ovl_workdir(dentry);
|
|
@@ -378,7 +378,7 @@ out_unlock:
|
|
return err;
|
|
return err;
|
|
}
|
|
}
|
|
|
|
|
|
-int ovl_copy_up(struct dentry *dentry)
|
|
|
|
|
|
+int ovl_copy_up_flags(struct dentry *dentry, int flags)
|
|
{
|
|
{
|
|
int err = 0;
|
|
int err = 0;
|
|
const struct cred *old_cred = ovl_override_creds(dentry->d_sb);
|
|
const struct cred *old_cred = ovl_override_creds(dentry->d_sb);
|
|
@@ -408,6 +408,9 @@ int ovl_copy_up(struct dentry *dentry)
|
|
|
|
|
|
ovl_path_lower(next, &lowerpath);
|
|
ovl_path_lower(next, &lowerpath);
|
|
err = vfs_getattr(&lowerpath, &stat);
|
|
err = vfs_getattr(&lowerpath, &stat);
|
|
|
|
+ /* maybe truncate regular file. this has no effect on dirs */
|
|
|
|
+ if (flags & O_TRUNC)
|
|
|
|
+ stat.size = 0;
|
|
if (!err)
|
|
if (!err)
|
|
err = ovl_copy_up_one(parent, next, &lowerpath, &stat);
|
|
err = ovl_copy_up_one(parent, next, &lowerpath, &stat);
|
|
|
|
|
|
@@ -418,3 +421,8 @@ int ovl_copy_up(struct dentry *dentry)
|
|
|
|
|
|
return err;
|
|
return err;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+int ovl_copy_up(struct dentry *dentry)
|
|
|
|
+{
|
|
|
|
+ return ovl_copy_up_flags(dentry, 0);
|
|
|
|
+}
|