Browse Source

Merge pull request #9678 from Andy2244/cifsd-update-05-08-2019

cifsd: update to git (2019-08-19)
lilik-openwrt-22.03
Rosen Penev 5 years ago
committed by GitHub
parent
commit
8f652372f1
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 176 additions and 20 deletions
  1. +3
    -3
      kernel/cifsd/Makefile
  2. +33
    -0
      kernel/cifsd/patches/001-mips-vfree_vmalloc-fix.patch
  3. +89
    -0
      kernel/cifsd/patches/002-fix-xattr_list.patch
  4. +4
    -4
      net/cifsd-tools/Makefile
  5. +31
    -5
      net/cifsd-tools/files/cifsd.init
  6. +16
    -8
      net/cifsd-tools/files/smb.conf.help

+ 3
- 3
kernel/cifsd/Makefile View File

@ -5,9 +5,9 @@ PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/cifsd-team/cifsd.git
PKG_SOURCE_DATE:=2019-07-17
PKG_SOURCE_VERSION:=0c3049e84fc7737cedbcef3e1791a570871168cd
PKG_MIRROR_HASH:=2717cb1e3d28e7ff5ea69c3fa2a6ae182b70bcdf8680a41a0df2b190b072d04b
PKG_SOURCE_DATE:=2019-08-19
PKG_SOURCE_VERSION:=b919acf32027cd5d7616726336305b47e24f02ab
PKG_MIRROR_HASH:=fd64b2cb78b8847f11ff79cbe06c3416bb0e67ca7433215d20c810fbfff6ee8f
PKG_MAINTAINER:=Andy Walsh <andy.walsh44+github@gmail.com>
PKG_LICENSE:=GPL-2.0-or-later


+ 33
- 0
kernel/cifsd/patches/001-mips-vfree_vmalloc-fix.patch View File

@ -0,0 +1,33 @@
--- a/vfs_cache.c
+++ b/vfs_cache.c
@@ -232,7 +232,7 @@ int __init cifsd_inode_hash_init(void)
size = bucketsize << inode_hash_shift;
/* init master fp hash table */
- inode_hashtable = __vmalloc(size, GFP_ATOMIC, PAGE_KERNEL);
+ inode_hashtable = vmalloc(size);
if (!inode_hashtable)
return -ENOMEM;
--- b/vfs.c
+++ b/vfs.c
@@ -17,6 +17,8 @@
#include <linux/fsnotify.h>
#include <linux/dcache.h>
#include <linux/fiemap.h>
+#include <linux/slab.h>
+#include <linux/vmalloc.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
#include <linux/sched/xacct.h>
--- b/vfs_cache.c
+++ b/vfs_cache.c
@@ -5,6 +5,8 @@
*/
#include <linux/fs.h>
+#include <linux/slab.h>
+#include <linux/vmalloc.h>
/* @FIXME */
#include "glob.h"

+ 89
- 0
kernel/cifsd/patches/002-fix-xattr_list.patch View File

@ -0,0 +1,89 @@
===
SMB1/SMB2 don't know exactly how vfs layer allocates xattr list,
via kmalloc() or vmalloc(). Introduce cifsd_vfs_xattr_free() and
keep both xattr allocation and de-allocation in one place.
Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
---
smb1pdu.c | 4 ++--
smb2pdu.c | 6 ++----
vfs.c | 6 ++++++
vfs.h | 1 +
4 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/smb1pdu.c b/smb1pdu.c
index 35599ef..8cb92cf 100644
--- a/smb1pdu.c
+++ b/smb1pdu.c
@@ -8,6 +8,7 @@
#include <linux/posix_acl_xattr.h>
#include <linux/namei.h>
#include <linux/statfs.h>
+#include <linux/vmalloc.h>
#include "glob.h"
#include "smb1pdu.h"
@@ -3844,8 +3845,7 @@ done:
rsp->ByteCount = cpu_to_le16(rsp_data_cnt + 5);
inc_rfc1001_len(&rsp->hdr, (10 * 2 + rsp->ByteCount));
out:
- if (xattr_list)
- vfree(xattr_list);
+ cifsd_vfs_xattr_free(xattr_list);
return rc;
}
diff --git a/smb2pdu.c b/smb2pdu.c
index 754258f..2727622 100644
--- a/smb2pdu.c
+++ b/smb2pdu.c
@@ -3867,8 +3867,7 @@ done:
rsp->OutputBufferLength = cpu_to_le32(rsp_data_cnt);
inc_rfc1001_len(rsp_org, rsp_data_cnt);
out:
- if (xattr_list)
- vfree(xattr_list);
+ cifsd_vfs_xattr_free(xattr_list);
return rc;
}
@@ -4151,8 +4150,7 @@ static void get_file_stream_info(struct cifsd_work *work,
/* last entry offset should be 0 */
file_info->NextEntryOffset = 0;
out:
- if (xattr_list)
- vfree(xattr_list);
+ cifsd_vfs_xattr_free(xattr_list);
rsp->OutputBufferLength = cpu_to_le32(nbytes);
inc_rfc1001_len(rsp_org, nbytes);
diff --git a/vfs.c b/vfs.c
index 556b1a5..6da6f8e 100644
--- a/vfs.c
+++ b/vfs.c
@@ -1550,6 +1550,12 @@ int cifsd_vfs_remove_xattr(struct dentry *dentry, char *attr_name)
return vfs_removexattr(dentry, attr_name);
}
+void cifsd_vfs_xattr_free(char *xattr)
+{
+ if (xattr)
+ vfree(xattr);
+}
+
int cifsd_vfs_unlink(struct dentry *dir, struct dentry *dentry)
{
int err = 0;
diff --git a/vfs.h b/vfs.h
index ee54daf..16b4f9e 100644
--- a/vfs.h
+++ b/vfs.h
@@ -186,6 +186,7 @@ int cifsd_vfs_xattr_stream_name(char *stream_name,
int cifsd_vfs_truncate_xattr(struct dentry *dentry, int wo_streams);
int cifsd_vfs_remove_xattr(struct dentry *dentry, char *attr_name);
+void cifsd_vfs_xattr_free(char *xattr);
int cifsd_vfs_kern_path(char *name, unsigned int flags, struct path *path,
bool caseless);

+ 4
- 4
net/cifsd-tools/Makefile View File

@ -1,13 +1,13 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=cifsd-tools
PKG_RELEASE:=2
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/cifsd-team/cifsd-tools.git
PKG_SOURCE_DATE:=2019-07-05
PKG_SOURCE_VERSION:=539fa21a8dd427a8ca2dc13c9a5a1c975be96d3c
PKG_MIRROR_HASH:=8c1b22d9926112a7e8ec94a3f731639a3789bef1aeb447f0bd7c41a1884e4dc5
PKG_SOURCE_DATE:=2019-08-19
PKG_SOURCE_VERSION:=bbeab27f0a1695f711fb84d9cd29a83f818ef90e
PKG_MIRROR_HASH:=f8bef545400aa8c0db6ba0fffdf0c0a2f201603503728f140df133aff3a39cbb
PKG_MAINTAINER:=Andy Walsh <andy.walsh44+github@gmail.com>
PKG_LICENSE:=GPL-2.0-or-later


+ 31
- 5
net/cifsd-tools/files/cifsd.init View File

@ -60,6 +60,9 @@ smb_add_share()
local read_list
local hide_dot_files
local veto_files
local inherit_owner
local force_create_mode
local force_directory_mode
config_get name $1 name
config_get path $1 path
@ -76,6 +79,9 @@ smb_add_share()
config_get read_list $1 read_list
config_get_bool hide_dot_files $1 hide_dot_files 0
config_get veto_files $1 veto_files
config_get inherit_owner $1 inherit_owner
config_get force_create_mode $1 force_create_mode
config_get force_directory_mode $1 force_directory_mode
[ -z "$name" ] || [ -z "$path" ] && return
@ -92,11 +98,14 @@ smb_add_share()
[ -n "$create_mask" ] && printf "\tcreate mask = %s\n" "$create_mask"
[ -n "$dir_mask" ] && printf "\tdirectory mask = %s\n" "$dir_mask"
[ -n "$force_create_mode" ] && printf "\tforce create mode = %s\n" "$force_create_mode"
[ -n "$force_directory_mode" ] && printf "\tforce directory mode = %s\n" "$force_directory_mode"
[ -n "$browseable" ] && printf "\tbrowseable = %s\n" "$browseable"
[ -n "$read_only" ] && printf "\tread only = %s\n" "$read_only"
[ -n "$writeable" ] && printf "\twriteable = %s\n" "$writeable"
[ -n "$guest_ok" ] && printf "\tguest ok = %s\n" "$guest_ok"
[ -n "$inherit_owner" ] && printf "\tinherit owner = %s\n" "$inherit_owner"
[ -n "$write_list" ] && printf "\twrite list = %s\n" "$write_list"
[ -n "$read_list" ] && printf "\tread list = %s\n" "$read_list"
@ -139,11 +148,6 @@ start_service()
exit 1
fi
[ -f /tmp/cifsd.lock ] && rm /tmp/cifsd.lock
# try remove again before start
[ -e /sys/module/cifsd ] && rmmod cifsd > /dev/null 2>&1
modprobe cifsd 2> /dev/null
if [ ! -e /sys/module/cifsd ]; then
logger -t 'cifsd' "modprobe of cifsd module failed, can\'t start cifsd!"
@ -155,3 +159,25 @@ start_service()
procd_set_param command /usr/sbin/cifsd --n
procd_close_instance
}
stop_service()
{
logger -t 'cifsd' "Stopping CIFSD userspace service."
killall cifsd > /dev/null 2>&1
sleep 1
[ -e /sys/class/cifsd-control/kill_server ] && echo hard > /sys/class/cifsd-control/kill_server
sleep 2
[ -e /sys/module/cifsd ] && rmmod cifsd > /dev/null 2>&1
# With open smb connections rmmod takes longer
if [ -e /sys/module/cifsd ]; then
sleep 5
rmmod cifsd > /dev/null 2>&1
fi
[ -f /tmp/cifsd.lock ] && rm /tmp/cifsd.lock
}
reload_service() {
stop_service "$@"
sleep 1
start_service "$@"
}

+ 16
- 8
net/cifsd-tools/files/smb.conf.help View File

@ -135,7 +135,20 @@
; Veto the Apple specific files that a NetAtalk server
; creates.
; veto files = /.AppleDouble/.bin/.AppleDesktop/Network Trash Folder/
;
; - inherit owner
; The ownership for new files and directories should be controlled
; by the ownership of the parent directory.
; Valid options are yes or no.
; - inherit smack
; This parameter can be used to ensure that if smack label exist
; on parent directories.
; Valid options are yes or no.
; - force create mode
; This parameter specifies a set of UNIX mode bit permissions
; that will always be set on a file created by cifsd.
; - force directory mode
; This parameter specifies a set of UNIX mode bit permissions
; that will always be set on a directory created by cifsd.
;
; Rules to update this file:
; - Every [share] definition should start on new line
@ -148,13 +161,8 @@
;******************************************************************************
[global]
server string = CIFSD on OpenWrt
netbios name = CIFSD
map to guest = Bad User
[share]
[homes]
comment = content server share
path = /mnt
guest ok = yes
create mask = 0777
directory mask = 0777
path = /tmp

Loading…
Cancel
Save