Skip to content

Commit 46b2850

Browse files
committed
Merge tag '9p-fixes-for-6.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs
Pull fs/9p fixes from Eric Van Hensbergen: "This contains a reversion of one of the original 6.9 patches which seems to have been the cause of most of the instability. It also incorporates several fixes to legacy support and cache fixes. There are few additional changes to improve stability, but I want another week of testing before sending them upstream" * tag '9p-fixes-for-6.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs: fs/9p: drop inodes immediately on non-.L too fs/9p: Revert "fs/9p: fix dups even in uncached mode" fs/9p: remove erroneous nlink init from legacy stat2inode 9p: explicitly deny setlease attempts fs/9p: fix the cache always being enabled on files with qid flags fs/9p: translate O_TRUNC into OTRUNC fs/9p: only translate RWX permissions for plain 9P2000
2 parents daa7577 + 7fd524b commit 46b2850

File tree

4 files changed

+23
-6
lines changed

4 files changed

+23
-6
lines changed

fs/9p/fid.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,6 @@ static inline struct p9_fid *v9fs_fid_clone(struct dentry *dentry)
4949
static inline void v9fs_fid_add_modes(struct p9_fid *fid, unsigned int s_flags,
5050
unsigned int s_cache, unsigned int f_flags)
5151
{
52-
if (fid->qid.type != P9_QTFILE)
53-
return;
54-
5552
if ((!s_cache) ||
5653
((fid->qid.version == 0) && !(s_flags & V9FS_IGNORE_QV)) ||
5754
(s_flags & V9FS_DIRECT_IO) || (f_flags & O_DIRECT)) {

fs/9p/vfs_file.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,7 @@ const struct file_operations v9fs_file_operations = {
520520
.splice_read = v9fs_file_splice_read,
521521
.splice_write = iter_file_splice_write,
522522
.fsync = v9fs_file_fsync,
523+
.setlease = simple_nosetlease,
523524
};
524525

525526
const struct file_operations v9fs_file_operations_dotl = {
@@ -534,4 +535,5 @@ const struct file_operations v9fs_file_operations_dotl = {
534535
.splice_read = v9fs_file_splice_read,
535536
.splice_write = iter_file_splice_write,
536537
.fsync = v9fs_file_fsync_dotl,
538+
.setlease = simple_nosetlease,
537539
};

fs/9p/vfs_inode.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ static int p9mode2perm(struct v9fs_session_info *v9ses,
8383
int res;
8484
int mode = stat->mode;
8585

86-
res = mode & S_IALLUGO;
86+
res = mode & 0777; /* S_IRWXUGO */
8787
if (v9fs_proto_dotu(v9ses)) {
8888
if ((mode & P9_DMSETUID) == P9_DMSETUID)
8989
res |= S_ISUID;
@@ -178,6 +178,9 @@ int v9fs_uflags2omode(int uflags, int extended)
178178
break;
179179
}
180180

181+
if (uflags & O_TRUNC)
182+
ret |= P9_OTRUNC;
183+
181184
if (extended) {
182185
if (uflags & O_EXCL)
183186
ret |= P9_OEXCL;
@@ -1061,8 +1064,6 @@ v9fs_stat2inode(struct p9_wstat *stat, struct inode *inode,
10611064
struct v9fs_session_info *v9ses = sb->s_fs_info;
10621065
struct v9fs_inode *v9inode = V9FS_I(inode);
10631066

1064-
set_nlink(inode, 1);
1065-
10661067
inode_set_atime(inode, stat->atime, 0);
10671068
inode_set_mtime(inode, stat->mtime, 0);
10681069
inode_set_ctime(inode, stat->mtime, 0);

fs/9p/vfs_super.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,21 @@ static int v9fs_statfs(struct dentry *dentry, struct kstatfs *buf)
244244
return res;
245245
}
246246

247+
static int v9fs_drop_inode(struct inode *inode)
248+
{
249+
struct v9fs_session_info *v9ses;
250+
251+
v9ses = v9fs_inode2v9ses(inode);
252+
if (v9ses->cache & (CACHE_META|CACHE_LOOSE))
253+
return generic_drop_inode(inode);
254+
/*
255+
* in case of non cached mode always drop the
256+
* inode because we want the inode attribute
257+
* to always match that on the server.
258+
*/
259+
return 1;
260+
}
261+
247262
static int v9fs_write_inode(struct inode *inode,
248263
struct writeback_control *wbc)
249264
{
@@ -268,6 +283,7 @@ static const struct super_operations v9fs_super_ops = {
268283
.alloc_inode = v9fs_alloc_inode,
269284
.free_inode = v9fs_free_inode,
270285
.statfs = simple_statfs,
286+
.drop_inode = v9fs_drop_inode,
271287
.evict_inode = v9fs_evict_inode,
272288
.show_options = v9fs_show_options,
273289
.umount_begin = v9fs_umount_begin,
@@ -278,6 +294,7 @@ static const struct super_operations v9fs_super_ops_dotl = {
278294
.alloc_inode = v9fs_alloc_inode,
279295
.free_inode = v9fs_free_inode,
280296
.statfs = v9fs_statfs,
297+
.drop_inode = v9fs_drop_inode,
281298
.evict_inode = v9fs_evict_inode,
282299
.show_options = v9fs_show_options,
283300
.umount_begin = v9fs_umount_begin,

0 commit comments

Comments
 (0)