inode.c (d9854c87f0ed1a5f32fec24bb5b5fb426ad79c26) inode.c (5812160eb50925d19c54be979c72d335fee17dbd)
1/*
2 *
3 * Copyright (C) 2011 Novell Inc.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
8 */

--- 25 unchanged lines hidden (view full) ---

34 err = setattr_prepare(dentry, attr);
35 if (err)
36 return err;
37
38 err = ovl_want_write(dentry);
39 if (err)
40 goto out;
41
1/*
2 *
3 * Copyright (C) 2011 Novell Inc.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 as published by
7 * the Free Software Foundation.
8 */

--- 25 unchanged lines hidden (view full) ---

34 err = setattr_prepare(dentry, attr);
35 if (err)
36 return err;
37
38 err = ovl_want_write(dentry);
39 if (err)
40 goto out;
41
42 if (attr->ia_valid & ATTR_SIZE) {
43 struct inode *realinode = d_inode(ovl_dentry_real(dentry));
44
45 err = -ETXTBSY;
46 if (atomic_read(&realinode->i_writecount) < 0)
47 goto out_drop_write;
48 }
49
42 err = ovl_copy_up(dentry);
43 if (!err) {
50 err = ovl_copy_up(dentry);
51 if (!err) {
52 struct inode *winode = NULL;
53
44 upperdentry = ovl_dentry_upper(dentry);
45
54 upperdentry = ovl_dentry_upper(dentry);
55
56 if (attr->ia_valid & ATTR_SIZE) {
57 winode = d_inode(upperdentry);
58 err = get_write_access(winode);
59 if (err)
60 goto out_drop_write;
61 }
62
46 if (attr->ia_valid & (ATTR_KILL_SUID|ATTR_KILL_SGID))
47 attr->ia_valid &= ~ATTR_MODE;
48
49 inode_lock(upperdentry->d_inode);
50 old_cred = ovl_override_creds(dentry->d_sb);
51 err = notify_change(upperdentry, attr, NULL);
52 revert_creds(old_cred);
53 if (!err)
54 ovl_copyattr(upperdentry->d_inode, dentry->d_inode);
55 inode_unlock(upperdentry->d_inode);
63 if (attr->ia_valid & (ATTR_KILL_SUID|ATTR_KILL_SGID))
64 attr->ia_valid &= ~ATTR_MODE;
65
66 inode_lock(upperdentry->d_inode);
67 old_cred = ovl_override_creds(dentry->d_sb);
68 err = notify_change(upperdentry, attr, NULL);
69 revert_creds(old_cred);
70 if (!err)
71 ovl_copyattr(upperdentry->d_inode, dentry->d_inode);
72 inode_unlock(upperdentry->d_inode);
73
74 if (winode)
75 put_write_access(winode);
56 }
76 }
77out_drop_write:
57 ovl_drop_write(dentry);
58out:
59 return err;
60}
61
62static int ovl_map_dev_ino(struct dentry *dentry, struct kstat *stat,
63 struct ovl_layer *lower_layer)
64{

--- 782 unchanged lines hidden ---
78 ovl_drop_write(dentry);
79out:
80 return err;
81}
82
83static int ovl_map_dev_ino(struct dentry *dentry, struct kstat *stat,
84 struct ovl_layer *lower_layer)
85{

--- 782 unchanged lines hidden ---