@@ -139,7 +139,7 @@ static void ncp_update_dates(struct inode *inode, struct nw_info_struct *nwi)
139
139
inode -> i_mode = nwi -> nfs .mode ;
140
140
}
141
141
142
- inode -> i_blocks = (inode -> i_size + NCP_BLOCK_SIZE - 1 ) >> NCP_BLOCK_SHIFT ;
142
+ inode -> i_blocks = (i_size_read ( inode ) + NCP_BLOCK_SIZE - 1 ) >> NCP_BLOCK_SHIFT ;
143
143
144
144
inode -> i_mtime .tv_sec = ncp_date_dos2unix (nwi -> modifyTime , nwi -> modifyDate );
145
145
inode -> i_ctime .tv_sec = ncp_date_dos2unix (nwi -> creationTime , nwi -> creationDate );
@@ -158,18 +158,21 @@ static void ncp_update_attrs(struct inode *inode, struct ncp_entry_info *nwinfo)
158
158
inode -> i_mode = server -> m .dir_mode ;
159
159
/* for directories dataStreamSize seems to be some
160
160
Object ID ??? */
161
- inode -> i_size = NCP_BLOCK_SIZE ;
161
+ i_size_write ( inode , NCP_BLOCK_SIZE ) ;
162
162
} else {
163
+ u32 size ;
164
+
163
165
inode -> i_mode = server -> m .file_mode ;
164
- inode -> i_size = le32_to_cpu (nwi -> dataStreamSize );
166
+ size = le32_to_cpu (nwi -> dataStreamSize );
167
+ i_size_write (inode , size );
165
168
#ifdef CONFIG_NCPFS_EXTRAS
166
169
if ((server -> m .flags & (NCP_MOUNT_EXTRAS |NCP_MOUNT_SYMLINKS ))
167
170
&& (nwi -> attributes & aSHARED )) {
168
171
switch (nwi -> attributes & (aHIDDEN |aSYSTEM )) {
169
172
case aHIDDEN :
170
173
if (server -> m .flags & NCP_MOUNT_SYMLINKS ) {
171
- if (/* (inode->i_size >= NCP_MIN_SYMLINK_SIZE)
172
- && */ (inode -> i_size <= NCP_MAX_SYMLINK_SIZE )) {
174
+ if (/* (size >= NCP_MIN_SYMLINK_SIZE)
175
+ && */ (size <= NCP_MAX_SYMLINK_SIZE )) {
173
176
inode -> i_mode = (inode -> i_mode & ~S_IFMT ) | S_IFLNK ;
174
177
NCP_FINFO (inode )-> flags |= NCPI_KLUDGE_SYMLINK ;
175
178
break ;
@@ -208,7 +211,7 @@ void ncp_update_inode2(struct inode* inode, struct ncp_entry_info *nwinfo)
208
211
}
209
212
210
213
/*
211
- * Fill in the inode based on the ncp_entry_info structure.
214
+ * Fill in the inode based on the ncp_entry_info structure. Used only for brand new inodes.
212
215
*/
213
216
static void ncp_set_attr (struct inode * inode , struct ncp_entry_info * nwinfo )
214
217
{
@@ -254,6 +257,7 @@ ncp_iget(struct super_block *sb, struct ncp_entry_info *info)
254
257
if (inode ) {
255
258
atomic_set (& NCP_FINFO (inode )-> opened , info -> opened );
256
259
260
+ inode -> i_mapping -> backing_dev_info = sb -> s_bdi ;
257
261
inode -> i_ino = info -> ino ;
258
262
ncp_set_attr (inode , info );
259
263
if (S_ISREG (inode -> i_mode )) {
@@ -565,10 +569,12 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
565
569
/* server->conn_status = 0; */
566
570
/* server->root_dentry = NULL; */
567
571
/* server->root_setuped = 0; */
572
+ mutex_init (& server -> root_setup_lock );
568
573
#ifdef CONFIG_NCPFS_PACKET_SIGNING
569
574
/* server->sign_wanted = 0; */
570
575
/* server->sign_active = 0; */
571
576
#endif
577
+ init_rwsem (& server -> auth_rwsem );
572
578
server -> auth .auth_type = NCP_AUTH_NONE ;
573
579
/* server->auth.object_name_len = 0; */
574
580
/* server->auth.object_name = NULL; */
@@ -593,7 +599,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
593
599
server -> nls_io = load_nls_default ();
594
600
#endif /* CONFIG_NCPFS_NLS */
595
601
596
- server -> dentry_ttl = 0 ; /* no caching */
602
+ atomic_set ( & server -> dentry_ttl , 0 ) ; /* no caching */
597
603
598
604
INIT_LIST_HEAD (& server -> tx .requests );
599
605
mutex_init (& server -> rcv .creq_mutex );
@@ -658,8 +664,10 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
658
664
goto out_disconnect ;
659
665
}
660
666
}
667
+ ncp_lock_server (server );
661
668
if (options & 2 )
662
669
server -> sign_wanted = 1 ;
670
+ ncp_unlock_server (server );
663
671
}
664
672
else
665
673
#endif /* CONFIG_NCPFS_PACKET_SIGNING */
@@ -720,6 +728,9 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
720
728
unload_nls (server -> nls_io );
721
729
unload_nls (server -> nls_vol );
722
730
#endif
731
+ mutex_destroy (& server -> rcv .creq_mutex );
732
+ mutex_destroy (& server -> root_setup_lock );
733
+ mutex_destroy (& server -> mutex );
723
734
out_fput2 :
724
735
if (server -> info_filp )
725
736
fput (server -> info_filp );
@@ -743,8 +754,6 @@ static void ncp_put_super(struct super_block *sb)
743
754
{
744
755
struct ncp_server * server = NCP_SBP (sb );
745
756
746
- lock_kernel ();
747
-
748
757
ncp_lock_server (server );
749
758
ncp_disconnect (server );
750
759
ncp_unlock_server (server );
@@ -756,6 +765,9 @@ static void ncp_put_super(struct super_block *sb)
756
765
unload_nls (server -> nls_vol );
757
766
unload_nls (server -> nls_io );
758
767
#endif /* CONFIG_NCPFS_NLS */
768
+ mutex_destroy (& server -> rcv .creq_mutex );
769
+ mutex_destroy (& server -> root_setup_lock );
770
+ mutex_destroy (& server -> mutex );
759
771
760
772
if (server -> info_filp )
761
773
fput (server -> info_filp );
@@ -771,8 +783,6 @@ static void ncp_put_super(struct super_block *sb)
771
783
vfree (server -> packet );
772
784
sb -> s_fs_info = NULL ;
773
785
kfree (server );
774
-
775
- unlock_kernel ();
776
786
}
777
787
778
788
static int ncp_statfs (struct dentry * dentry , struct kstatfs * buf )
@@ -851,10 +861,8 @@ int ncp_notify_change(struct dentry *dentry, struct iattr *attr)
851
861
852
862
result = - EIO ;
853
863
854
- lock_kernel ();
855
-
856
864
server = NCP_SERVER (inode );
857
- if (( !server ) || ! ncp_conn_valid ( server ))
865
+ if (!server ) /* How this could happen? */
858
866
goto out ;
859
867
860
868
/* ageing the dentry to force validation */
@@ -981,8 +989,6 @@ int ncp_notify_change(struct dentry *dentry, struct iattr *attr)
981
989
result = ncp_modify_file_or_subdir_dos_info (NCP_SERVER (inode ),
982
990
inode , info_mask , & info );
983
991
if (result != 0 ) {
984
- result = - EACCES ;
985
-
986
992
if (info_mask == (DM_CREATE_TIME | DM_CREATE_DATE )) {
987
993
/* NetWare seems not to allow this. I
988
994
do not know why. So, just tell the
@@ -1005,7 +1011,8 @@ int ncp_notify_change(struct dentry *dentry, struct iattr *attr)
1005
1011
mark_inode_dirty (inode );
1006
1012
1007
1013
out :
1008
- unlock_kernel ();
1014
+ if (result > 0 )
1015
+ result = - EACCES ;
1009
1016
return result ;
1010
1017
}
1011
1018
0 commit comments