Commit 46b28503 authored by Linus Torvalds's avatar Linus Torvalds

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
parents daa75776 7fd524b9
...@@ -49,9 +49,6 @@ static inline struct p9_fid *v9fs_fid_clone(struct dentry *dentry) ...@@ -49,9 +49,6 @@ static inline struct p9_fid *v9fs_fid_clone(struct dentry *dentry)
static inline void v9fs_fid_add_modes(struct p9_fid *fid, unsigned int s_flags, static inline void v9fs_fid_add_modes(struct p9_fid *fid, unsigned int s_flags,
unsigned int s_cache, unsigned int f_flags) unsigned int s_cache, unsigned int f_flags)
{ {
if (fid->qid.type != P9_QTFILE)
return;
if ((!s_cache) || if ((!s_cache) ||
((fid->qid.version == 0) && !(s_flags & V9FS_IGNORE_QV)) || ((fid->qid.version == 0) && !(s_flags & V9FS_IGNORE_QV)) ||
(s_flags & V9FS_DIRECT_IO) || (f_flags & O_DIRECT)) { (s_flags & V9FS_DIRECT_IO) || (f_flags & O_DIRECT)) {
......
...@@ -520,6 +520,7 @@ const struct file_operations v9fs_file_operations = { ...@@ -520,6 +520,7 @@ const struct file_operations v9fs_file_operations = {
.splice_read = v9fs_file_splice_read, .splice_read = v9fs_file_splice_read,
.splice_write = iter_file_splice_write, .splice_write = iter_file_splice_write,
.fsync = v9fs_file_fsync, .fsync = v9fs_file_fsync,
.setlease = simple_nosetlease,
}; };
const struct file_operations v9fs_file_operations_dotl = { const struct file_operations v9fs_file_operations_dotl = {
...@@ -534,4 +535,5 @@ const struct file_operations v9fs_file_operations_dotl = { ...@@ -534,4 +535,5 @@ const struct file_operations v9fs_file_operations_dotl = {
.splice_read = v9fs_file_splice_read, .splice_read = v9fs_file_splice_read,
.splice_write = iter_file_splice_write, .splice_write = iter_file_splice_write,
.fsync = v9fs_file_fsync_dotl, .fsync = v9fs_file_fsync_dotl,
.setlease = simple_nosetlease,
}; };
...@@ -83,7 +83,7 @@ static int p9mode2perm(struct v9fs_session_info *v9ses, ...@@ -83,7 +83,7 @@ static int p9mode2perm(struct v9fs_session_info *v9ses,
int res; int res;
int mode = stat->mode; int mode = stat->mode;
res = mode & S_IALLUGO; res = mode & 0777; /* S_IRWXUGO */
if (v9fs_proto_dotu(v9ses)) { if (v9fs_proto_dotu(v9ses)) {
if ((mode & P9_DMSETUID) == P9_DMSETUID) if ((mode & P9_DMSETUID) == P9_DMSETUID)
res |= S_ISUID; res |= S_ISUID;
...@@ -178,6 +178,9 @@ int v9fs_uflags2omode(int uflags, int extended) ...@@ -178,6 +178,9 @@ int v9fs_uflags2omode(int uflags, int extended)
break; break;
} }
if (uflags & O_TRUNC)
ret |= P9_OTRUNC;
if (extended) { if (extended) {
if (uflags & O_EXCL) if (uflags & O_EXCL)
ret |= P9_OEXCL; ret |= P9_OEXCL;
...@@ -1061,8 +1064,6 @@ v9fs_stat2inode(struct p9_wstat *stat, struct inode *inode, ...@@ -1061,8 +1064,6 @@ v9fs_stat2inode(struct p9_wstat *stat, struct inode *inode,
struct v9fs_session_info *v9ses = sb->s_fs_info; struct v9fs_session_info *v9ses = sb->s_fs_info;
struct v9fs_inode *v9inode = V9FS_I(inode); struct v9fs_inode *v9inode = V9FS_I(inode);
set_nlink(inode, 1);
inode_set_atime(inode, stat->atime, 0); inode_set_atime(inode, stat->atime, 0);
inode_set_mtime(inode, stat->mtime, 0); inode_set_mtime(inode, stat->mtime, 0);
inode_set_ctime(inode, stat->mtime, 0); inode_set_ctime(inode, stat->mtime, 0);
......
...@@ -244,6 +244,21 @@ static int v9fs_statfs(struct dentry *dentry, struct kstatfs *buf) ...@@ -244,6 +244,21 @@ static int v9fs_statfs(struct dentry *dentry, struct kstatfs *buf)
return res; return res;
} }
static int v9fs_drop_inode(struct inode *inode)
{
struct v9fs_session_info *v9ses;
v9ses = v9fs_inode2v9ses(inode);
if (v9ses->cache & (CACHE_META|CACHE_LOOSE))
return generic_drop_inode(inode);
/*
* in case of non cached mode always drop the
* inode because we want the inode attribute
* to always match that on the server.
*/
return 1;
}
static int v9fs_write_inode(struct inode *inode, static int v9fs_write_inode(struct inode *inode,
struct writeback_control *wbc) struct writeback_control *wbc)
{ {
...@@ -268,6 +283,7 @@ static const struct super_operations v9fs_super_ops = { ...@@ -268,6 +283,7 @@ static const struct super_operations v9fs_super_ops = {
.alloc_inode = v9fs_alloc_inode, .alloc_inode = v9fs_alloc_inode,
.free_inode = v9fs_free_inode, .free_inode = v9fs_free_inode,
.statfs = simple_statfs, .statfs = simple_statfs,
.drop_inode = v9fs_drop_inode,
.evict_inode = v9fs_evict_inode, .evict_inode = v9fs_evict_inode,
.show_options = v9fs_show_options, .show_options = v9fs_show_options,
.umount_begin = v9fs_umount_begin, .umount_begin = v9fs_umount_begin,
...@@ -278,6 +294,7 @@ static const struct super_operations v9fs_super_ops_dotl = { ...@@ -278,6 +294,7 @@ static const struct super_operations v9fs_super_ops_dotl = {
.alloc_inode = v9fs_alloc_inode, .alloc_inode = v9fs_alloc_inode,
.free_inode = v9fs_free_inode, .free_inode = v9fs_free_inode,
.statfs = v9fs_statfs, .statfs = v9fs_statfs,
.drop_inode = v9fs_drop_inode,
.evict_inode = v9fs_evict_inode, .evict_inode = v9fs_evict_inode,
.show_options = v9fs_show_options, .show_options = v9fs_show_options,
.umount_begin = v9fs_umount_begin, .umount_begin = v9fs_umount_begin,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment